如何在 MVC2 应用程序上将 HTTP 协议更改为 HTTPS?
我有一个在 MVC2 上开发的应用程序,但我需要在身份验证后将其从 HTTP 更改为 HTTPS。我该如何管理它以及我必须将代码放在哪里?
谢谢你,
伊格纳西奥
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将过滤器添加
到您的操作方法中
Add the filter
to your action method
这对我来说非常有用:
http://weblogs.asp.net/jeffwids/archive/2010/08/19/how-to-switch- Between-http-and-https-in-asp-net -mvc2.aspx
我向其中添加了几行,以支持来自共享站点主机的 ajax 请求。
http://arturito.net/2011/08/05/how-to-switch- Between-http-and-https-in-asp-net-mvc2-and-允许 ajax-requests-from-site-master/
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/