public string GetRootURI()
{
string UrlAuthority = Request.Url.GetLeftPart(UriPartial.Authority);
if (Request.ApplicationPath == null || Request.ApplicationPath == "/")
{
//直接安装在Web站点
return UrlAuthority;
}
else
{
//安装在虚拟子目录下
return UrlAuthority + Request.ApplicationPath;
}
}
转载于:https://www.cnblogs.com/zhongjy001/archive/2009/10/16/1584494.html