How do I enable ssl for all controllers in mvc application
问题 I have a MVC 5 app and I installed the ssl certificate and I'm now connecting with https, but in my code I had to set the '[requirehttps]' attribute on the homecontroller like so: [RequireHttps] public class HomeController : Controller {} Isn't there a way to set it for the whole application so I don't have to do this for each and every controller I have in the app? 回答1: Use the RegisterGlobalFilters method in your FiltersConfig . public class FilterConfig { public static void