ASP.NET MVC RequireHttps

asp.net-mvc, asp.net-mvc-2, asp.net-mvc-futures, https, ssl

Solution

My guess:

[RequireHttps] //apply to all actions in controller
public class SomeController 
{
  //... or ...
  [RequireHttps] //apply to this action only
  public ActionResult SomeAction()
  {
  }

}

Problem

How do I use the ASP.NET MVC 2 Preview 2 Futures RequireHttps attribute? I want to prevent unsecured HTTP requests from being sent to an action method. I want to automatically redirect to HTTPS. MSDN: - RequireHttpsAttribute - RequireHttpsAttribute Members - RequireHttpsAttribute.HandleNonHttpsRequest Method How do I use this feature?

Original source

Related problems