加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

如何使用代码隐藏技术在asp.net中获取当前页面的URL?

发布时间:2020-12-16 00:18:28 所属栏目:asp.Net 来源:网络整理
导读:我想获得像abc.aspx这样的页面的Url.我怎样才能使用代码背后的技术.任何想法.? 解决方法 完整详细信息,您可以稍后使用字符串操作进行高级操作: string url = HttpContext.Current.Request.Url.AbsoluteUri;// http://localhost:1302/TESTERS/Default6.aspx
我想获得像abc.aspx这样的页面的Url.我怎样才能使用代码背后的技术.任何想法.?

解决方法

完整详细信息,您可以稍后使用字符串操作进行高级操作:
string url = HttpContext.Current.Request.Url.AbsoluteUri;
// http://localhost:1302/TESTERS/Default6.aspx

string path = HttpContext.Current.Request.Url.AbsolutePath;
// /TESTERS/Default6.aspx

string host = HttpContext.Current.Request.Url.Host;
// localhost

How to get the URL of the current page in C#

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读