【发布时间】:2012-10-27 17:18:19
【问题描述】:
我有一个具有路径的本地应用程序:
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;
标签: c# asp.net http httpcontext