Truncating Query String & Returning Clean URL C# ASP.net

后端 未结 7 1870
遥遥无期
遥遥无期 2020-12-25 10:11

I would like to take the original URL, truncate the query string parameters, and return a cleaned up version of the URL. I would like it to occur across the whole applicatio

7条回答
  •  滥情空心
    2020-12-25 10:25

    Here is a quick way of getting the root path sans the full path and query.

    string path = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery,"");
    

提交回复
热议问题