我想获得ASP.NET MVC中的部分URL

时间:2010-10-13 14:04:38

标签: c# asp.net-mvc

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

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

1 个答案:

答案 0 :(得分:4)

使用此:

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