如何获取不包括查询字符串参数的当前页面 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)
关于c# - 如何从不包括查询字符串参数的url获取当前页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55265112/