views:

73

answers:

1

I use RequireSsl attribute to redirect to a https url if an action is decorated with it.

RequireSsl

I now need a good way to link back to url that dont use https. This post explains my problem in clear english: link to http

I am not shure what the easiest way is. In old school ASP.NET I used secureWebPages on codeproject. To be honest I dont know exactly what this httpModule does: It just worked.

I guess it does a 302 redirect to a http url if a page is requested via https that only requires http. My first idea is to have an action filter like RequireSll but with a rule that redirects to http if "Request.IsSecure". It only gets a bit awkward at the end. Almost all of my url dont require https, thats why I would have to decorate nearly all of the controllers with a "NoSsl" attribute.

How do you handle this situation?

+1  A: 

My site has simple navigation and I just tailor the link with the protocol:

<a href="<%= Url.RouteUrl("Content", new { action = "AboutUs"}, "http") %>" title="About Us">About Us</a>
SevenCentral
Thats a good way. I am not a friend of absolute url, but because they are generated by te URLHelperExtension they dont feel that much absolute anymore.
Malcolm Frexner