How to turn off MVC.NET version 2's RequireHttps attribute?

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2009-10-24T17:18:17Z Indexed on 2010/03/31 17:23 UTC
Read the original article Hit count: 847

Filed under:

I see that version 2 of MVC.NET now has a RequireHttps attribute, which works great for me. However, what's a good strategy for turning the effect off? For example, I want to use Https on some pages, but regular Http on others. Should I create my own RequireHttp attribute?

EDIT: I'm using my own RequireHttp attribute, and it works fine, but I'm wondering if there's some built-in functionality in MVC.NET Version 2 that I'm missing.

EDIT 2: I must not have been clear. My question concerns the following: if you use RequireHttps, then any requests after that will be over Https even if the Controller or Action is not decorated with RequireHttps. Unless I'm mistaken, you need a 2nd attribute such as RequireHttp to redirect requests to Http instead of Https.

© Stack Overflow or respective owner

Related posts about asp.net-mvc