[ASP.NET]如何返回当前页面的文件名

      编程手札 2005-5-20 10:9
如果有一个控件用在不同页面中,且控件中都有一个链接用于传递参数给该控件,那么这时如在链接中指定页面名就显得很死了。

所以遇到这种情况,最好用系统函数来调用当前页面的文件名

这儿有一个方法可以实现

using System.Web;

string thisPage;
thisPage = HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Length - 1 ];



然后将 thisPage 代入链接处,后面加“?params=value”就可以了

标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}