ASP.NET MVC RequireHttps in Production Only

前端 未结 15 1863
花落未央
花落未央 2020-11-28 18:23

I want to use the RequireHttpsAttribute to prevent unsecured HTTP requests from being sent to an action method.

C#

[RequireHttps] //apply to all acti         


        
15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 18:53

    If you can derive and override - do it. If you can't - MVC comes with sources, just take the sources and create your own [ForceHttps] attribute that checks IsLocal.

提交回复
热议问题