如何获取当前的URL路径. [英] How to get current url path.

查看:64
本文介绍了如何获取当前的URL路径.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用asp.net 2.0,如何使用c#编码获取当前的URL路径,因为我正在使用可重写的概念,因此我输入了www.abc.com/pagename.aspx,它会在URL www.abc之后进行重写. com/praba

现在我需要当前的URL路径,但是显示的当前URL为www.abc.com/pagename.aspx.
我如何在c#



i''m using asp.net 2.0,how can i get current url path in c# coding, since i''m using rewritable concept so i entered www.abc.com/pagename.aspx ,it rewrite following url www.abc.com/praba

now i need current url path ,but current url displayed www.abc.com/pagename.aspx.
how can i get www.abc.com/path url in c#

推荐答案

中获取www.abc.com/path URL您可以通过使用以下类(Uri)获取路径详细信息
HttpContext.Current.Request.Url
You can get path details by using below class (Uri)
HttpContext.Current.Request.Url


这篇关于如何获取当前的URL路径.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆