public string GetRootPath()
{
// 是否为SSL认证站点
string secure = HttpContext.Current.Request.ServerVariables["HTTPS"];
string httpProtocol = (secure == "on" ? "https://" : "http://");
// 服务器名称
string serverName = HttpContext.Current.Request.ServerVariables["Server_Name"];
// 应用服务名称
string applicationName = HttpContext.Current.Request.ApplicationPath;
return httpProtocol + "/" + serverName + "/" + applicationName;
}
转:http://syveen.cnblogs.com/archive/2005/12/07/292489.html