string mServerUrl ="";
if (System.Web.HttpRuntime.AppDomainAppVirtualPath == "/")
mServerUrl = "http://" + Request.ServerVariables["HTTP_HOST"] + "/Web/";
else
mServerUrl = "http://" + Request.ServerVariables["HTTP_HOST"] + System.Web.HttpRuntime.AppDomainAppVirtualPath + "/Web/" ;
试试
这就是当前路径了
url = url.Substring(0,url.LastIndexOf("/") + 1); Response.Write(url);
E:\PAGE\TT_BASE\Web\Default.aspx 我要的是这样的http://127.0.0.1/Web/
同样感谢,继续等答案
HttpContext.Current.Request.Url.Port.ToString();(端口)
HttpRuntime.AppDomainAppVirtualPath;(虚拟目录Web)
组合起来就是你要的结果了