我正在生成运行时<a>链接。要完成链接,我使用以下代码:
string appPath = protocol + System.Web.HttpContext.Current.Request.ServerVariables["HTTP_HOST"] + System.Web.HttpContext.Current.Request.ApplicationPath;.
但是当用户尝试从以下位置打开网站时:http://123.123.123.123/testApp此时我的链接是用http://myservername.com/testApp.
我想要用户输入的地址。
如果用户从链接打开打开http://123.123.123.123/testApp的网站应该是
http://123.123.123.123/testApp/Default.aspx
如果用户从链接打开网站http://myservername.com/testApp应该是
http://myservername.com/testApp/Default.aspx