Redirect away from HTTPS with ASP.NET MVC App

Posted by Amadiere on Stack Overflow See other posts from Stack Overflow or by Amadiere
Published on 2010-04-01T13:21:56Z Indexed on 2010/04/01 13:23 UTC
Read the original article Hit count: 309

Filed under:
|
|

I'm using ASP.NET MVC 2 and have a login page that is secured via HTTPS. To ensure that the user always accesses those pages via SSL, I've added the attribute [RequiresHttps] to the controller. This does the job perfectly.

When they have successfully logged in, I'd like to redirect them back to HTTP version. However, there isn't a [RequiresHttp] attribute and I'm struggling to get my head around how I might achieve this.

The added (potential) complication is that the website when in production is hosted at the route of the domain, but for development and testing purposes it is within a sub directory / virtual directory / application.

Am I over-thinking this and is there an easy solution staring me in the face? Or is it a little more complex?

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc