直接获取网页的名称,而不是URL。
代码如下:
PageName = Request.Path;
int nLength = this.pageName.Length - this.pageName.LastIndexOf('/') - 1;
string sPageName = this.pageName.Substring(this.pageName.LastIndexOf('/') + 1, nLength);
知识拓展:获取URL的几种方法。
HttpContext.Current.Request.Url.PathAndQuery
Request.Url.PathAndQuery
string 类型。等于 Request.Url.AbsolutePath 和 Request.Url.Query 相加。
Request.Url.AbsolutePath
string 类型。指当前页面 URL 的绝对路径,不包括查询字符串部分。
示例:/test/Default.aspx
Request.Url.Query
string 类型。指当前页面 URL 的查询字符串,从“?”开始。
示例:?a=1&b=2
Copyright 2007-2014-forever Inc. all Rights Reserved. 六合开奖结果现场直播.版权所有
网站备案号:滇ICP备11001339号-7 dzwebs@126.com