我在其中有一个路径的本地应用程序:HttpContext.Current.Request.Url.Host它返回什么?
http://localhost:950/m/pages/Searchresults.aspx?search=knife&filter=kitchen
但是当这种去集成环境或者是生产,这将是像
http://www.someshopping.com/m/pages/SearchResults.aspx?search=knife&filter=kitchen
对于某些情况下,我需要只是通过:
www.someshopping.com
我的XSLT文件,并在功能之一,我使用这个:
string currentURL = HttpContext.Current.Request.Url.Host;
这会在本地环境中返回我“localhost”。将相同的代码返回我:
www.someshopping.com生产(我不需要的http://)
只是不想采取任何机会。所以问了这个愚蠢的问题。
也许应该是'string host = HttpContext.Current.Request.Url.Host;' – Spike0xff