簡體   English   中英

如何從 url 獲取當前頁面,不包括查詢字符串參數

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM