asp.net-mvcrequiressl

How do I do the OPPOSITE of [RequireHttps(Redirect=true)] in ASP.NET MVC


I know the easy way to get to an SSL page in ASP.NET MVC - via the [RequireSSL] attribute but I'm a little confused to the best way to do the opposite.

I have many links on my site in a header bar and most of those links don't require SSL and I don't want to still use SSL.

The futures project makes it very easy to redirect automatically to an SSL page with [RequireSSL(Redirect=true)], but it doesnt seem to make it easy to get out of this context and automatically redirect back to http.

What am I missing?


Solution

  • You're not missing anything; there is no out-of-the-box functionality for this. You can easily create your own by taking the RequireSslAttribute source and modifying it.