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 port = HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
// 应用服务名称
string applicationName = HttpContext.Current.Request.ApplicationPath;
return httpProtocol + serverName + (port.Length > 0 ? ":" + port : string.Empty) + applicationName;
}
{
// 是否为SSL认证站点
string secure = HttpContext.Current.Request.ServerVariables["HTTPS"];
string httpProtocol = (secure == "on" ? "https://" : "http://");
// 服务器名称
string serverName = HttpContext.Current.Request.ServerVariables["Server_Name"];
string port = HttpContext.Current.Request.ServerVariables["SERVER_PORT"];
// 应用服务名称
string applicationName = HttpContext.Current.Request.ApplicationPath;
return httpProtocol + serverName + (port.Length > 0 ? ":" + port : string.Empty) + applicationName;
}