web根路径

public static string UrlScheme
    {
        get
        {
            return System.Web.HttpContext.Current.Request.Url.Scheme + "://";
        }
    }
    public static string AppUrl
    {
        get
        {
            if (!String.IsNullOrEmpty(_AppUrl))
            {
                return _AppUrl;
            }
            else
            {
                string Url = UrlScheme + System.Web.HttpContext.Current.Request.Url.Authority + System.Web.HttpContext.Current.Request.ApplicationPath;
                Url = Url.TrimEnd('/');
                return Url;
            }
        }
    }
    private static string _AppUrl;
原文地址:https://www.cnblogs.com/94cool/p/1691087.html