c# - 我想获取 ASP.NET MVC 中的部分 url

标签 c# asp.net-mvc

http://localhost:6223/RssFeed/RssFeedsLang?lang=Dari&cat=News

如何获取网址的http://localhost:6223/?基本上我想丢弃网址中的 /RssFeed/RssFeedsLang?lang=Dari&cat=News 。我怎样才能做到这一点?

最佳答案

使用这个:

string urlBase = Request.Url.GetLeftPart( UriPartial.Authority ) + Request.ApplicationPath;

关于c# - 我想获取 ASP.NET MVC 中的部分 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3924533/

相关文章:

c# - ASP.net MVC Linq-to-SQL 插入问题

c# - 在新租户的 OwinStartup 之后添加 Owin 管道中间件

c# - Excel 互操作 - 如何停止数字(存储为文本)为 "evaluated"

c# - 如何更改 WSDL 客户端的预期内容类型?

c# - 如何通过 HTTPS 实现 ServiceStack.net rest 调用?

jquery - 使用c# Ajax请求MVC 4.0

c# - 如何使 ASP.NET Core Web API 操作异步执行?

c# - 方向确定算法混合左右

asp.net-mvc - 在 asp.net MVC 中调用经过身份验证的 Web 服务

c# - 将linq查询结果存储在Model中