开发者

Link to actions that dont use https from a page that uses https

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 a开发者_如何学JAVAt 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?


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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜