Asp.net里获取应用程序路径语句

116 阅读1分钟

Asp.net里获取应用程序路径语句,记录一下,总是记不住:

        ContentResult invalid()
        {
            var host = System.Web.HttpContext.Current.Request.Url.Authority;
            var app = System.Web.HttpContext.Current.Request.ApplicationPath;
            return Error("非法用户,请联系管理员",$@"//{host}/{app}/Home/InvalidUser");
        }

相关文章:
老革命老问题之相对路径转绝对路径