復制代碼 代碼如下:
public static string GetRootURI()
{
string AppPath = "";
HttpContext HttpCurrent = HttpContext.Current;
HttpRequest Req;
if (HttpCurrent != null)
{
Req = HttpCurrent.Request;
string UrlAuthority = Req.Url.GetLeftPart(UriPartial.Authority);
if (Req.ApplicationPath == null || Req.ApplicationPath == "http://www.companysz.com/")
//直接安裝在 Web 站點
AppPath = UrlAuthority;
else
//安裝在虛擬子目錄下
AppPath = UrlAuthority + Req.ApplicationPath;
}
return AppPath;
}
新聞熱點
疑難解答
圖片精選