![](/img/trans.png)
[英]Get current page URL without query parameters - Razor Html helper?
[英]how to get current page from url excluding query string parameters
如何獲取不包括查詢字符串參數的當前頁面 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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.