【发布时间】:2012-11-07 15:31:34
【问题描述】:
我有以下路径:
-http://localhost/portal/reportview.aspx
但我需要检索前 3 部分:
-http://localhost/portal/
我试过HttpContext.Current.Request.Url.GetLeftPart();,但没有成功。
【问题讨论】:
-
如果您在 Request.Url 上放置一个调试中断,您可以看到所有可以给您的项目,例如
.Path并且可以完成这项工作。比提出问题要快。 -
总是前三个部分还是删除“reportview.aspx”?或者换一种说法,如果url是
http://localhost/portal/sub/page.aspx呢?