开发者

How to change HTTP protocol for HTTPS on a MVC2 application?

开发者 https://www.devze.com 2023-01-15 19:16 出处:网络
I have an application developed on MVC2 but I need 开发者_开发技巧it to change from HTTP to HTTPS after authentication. How do I manage that and where do I have to put the code?

I have an application developed on MVC2 but I need 开发者_开发技巧it to change from HTTP to HTTPS after authentication. How do I manage that and where do I have to put the code?

Thank you,

Ignacio


Add the filter

[UseHttps]

to your action method


That worked great for me:

http://weblogs.asp.net/jeffwids/archive/2010/08/19/how-to-switch-between-http-and-https-in-asp-net-mvc2.aspx

I added couple of lines to it in order to support ajax requests from shared site master.

http://arturito.net/2011/08/05/how-to-switch-between-http-and-https-in-asp-net-mvc2-and-allow-ajax-requests-from-site-master/

0

精彩评论

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