如何获取当前页面URL,不包括查询字符串参数。我的网址就像这个https://mywebsite.com/myproject/detailspage?id=2812
我想只得到https://mywebsite.com/myproject/detailspage。
我试过这个但没有帮助。
string path = HttpContext.Current.Request.Url.AbsolutePath;
string url = HttpContext.Current.Request.Url.AbsoluteUri;
请提出任何建议。
Request.Url.GetLeftPart(UriPartial.Path)