ASP.NET MVC 下的 SSL 页面 [英] SSL pages under ASP.NET MVC
本文介绍了ASP.NET MVC 下的 SSL 页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为基于 ASP.NET MVC 的站点中的某些页面使用 HTTPS?
How do I go about using HTTPS for some of the pages in my ASP.NET MVC based site?
Steve Sanderson 有一个关于如何在 Preview 4 中以 DRY 方式执行此操作的非常好的教程:
Steve Sanderson has a pretty good tutorial on how to do this in a DRY way on Preview 4 at:
http://blog.codeville.net/2008/08/05/adding-httpsssl-support-to-aspnet-mvc-routing/
预览版 5 是否有更好/更新的方式?,
Is there a better / updated way with Preview 5?,
推荐答案
如果您正在使用 ASP.NET MVC 2 Preview 2 或更高版本,您现在可以简单地使用:
If you are using ASP.NET MVC 2 Preview 2 or higher, you can now simply use:
[RequireHttps]
public ActionResult Login()
{
return View();
}
不过,order 参数值得注意,如 此处提及.
Though, the order parameter is worth noting, as mentioned here.
这篇关于ASP.NET MVC 下的 SSL 页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文