gpt4 book ai didi

c# - 如何从不包括查询字符串参数的url获取当前页面

转载 作者:太空宇宙 更新时间:2023-11-03 12:05:30 24 4
gpt4 key购买 nike

如何获取不包括查询字符串参数的当前页面 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com