MVC RequireHttps entire site

前端 未结 9 1091
遇见更好的自我
遇见更好的自我 2020-12-23 13:24

I have read the previous posts about using the RequireHttpsAttribute to secure individual controllers:

ASP.NET MVC RequireHttps in Production Only

but is the

9条回答
  •  醉酒成梦
    2020-12-23 13:37

    Register the RequireHttpsAttribute as a global filter.

    In global.asax:

    protected void Application_Start()
    {
        GlobalFilters.Filters.Add(new RequireHttpsAttribute());
    
        //... other stuff
    }
    

提交回复
热议问题