如何使用code背后的技术来获得当前页面的网址在asp.net? [英] How to get Current Page's Url in asp.net using code behind technique?
本文介绍了如何使用code背后的技术来获得当前页面的网址在asp.net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想获得像abc.aspx页面的URL。我怎样才能得到背后的技术这一点使用code。任何想法?
I want to get Url of the page like abc.aspx. how can i get this using code behind technique. Any idea.?
推荐答案
的详细介绍,您可以在以后使用的字符串操作的高级操作:
Full Details, you can later use string Operations for advanced manipulation:
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
<一个href=\"http://stackoverflow.com/questions/593709/how-to-get-the-url-of-the-current-page-in-c-sharp\">How得到当前页面的URL在C#
这篇关于如何使用code背后的技术来获得当前页面的网址在asp.net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文