获取本页面名称如何写呀
时间:2011-12-10
来源:互联网
{
Response.Write(this.Page.Theme);
}
我就想获取本页面的名称,但是以上这样子写,没有任何反映,该如何写代码呢
作者: zhengyingcan 发布时间: 2011-12-10
作者: q107770540 发布时间: 2011-12-10
作者: zhengyingcan 发布时间: 2011-12-10
作者: orain 发布时间: 2011-12-10
作者: orain 发布时间: 2011-12-10
如果不要扩展名 .aspx,可以这样:System.IO.Path.GetFileNameWithoutExtension(Request.PhysicalPath)
+1
附带解释:
Request.PhysicalPath-获取物理路径
System.IO.Path.GetFileNameWithoutExtension()-取得不带扩展名的文件名称
作者: heycoder 发布时间: 2011-12-12
作者: PoolBoys 发布时间: 2011-12-12
引用 4 楼 orain 的回复:
如果不要扩展名 .aspx,可以这样:System.IO.Path.GetFileNameWithoutExtension(Request.PhysicalPath)
+1
附带解释:
Request.PhysicalPath-获取物理路径
System.IO.Path.GetFileNameWithoutExtension()-取得不带……
非常的正解呀
作者: zhengyingcan 发布时间: 2011-12-12
作者: zhanglong_longlong 发布时间: 2011-12-12
"http://"是协议名
"www.test.com"是域名
"aaa"是站点名
"bbb.aspx"是页面名(文件名)
"id=5&name=kelli"是参数
【0】来源URL
string url=Request.UrlReferrer.ToString();
【1】获取 完整url (协议名+域名+站点名+文件名+参数)支持带端口
string url=Request.Url.ToString();
url= http://www.test.com/aaa/bbb.aspx?id=5&name=kelli
【2】获取 站点名+页面名+参数:
string url=Request.RawUrl;
(或 string url=Request.Url.PathAndQuery;)
url= /aaa/bbb.aspx?id=5&name=kelli
【3】获取 站点名+页面名:
string url=HttpContext.Current.Request.Url.AbsolutePath;
(或 string url= HttpContext.Current.Request.Path;)
url= aaa/bbb.aspx
【4】获取 域名:
string url=HttpContext.Current.Request.Url.Host;
url= www.test.com
【5】获取 参数:
string url= HttpContext.Current.Request.Url.Query;
url= ?id=5&name=kelli
作者: gzpepco 发布时间: 2011-12-12
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28