ASP.NET MVC RequireHttps [英] ASP.NET MVC RequireHttps
本文介绍了ASP.NET MVC RequireHttps的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用ASP.NET MVC 2 preVIEW 2期货RequireHttps属性?
How do I use the ASP.NET MVC 2 Preview 2 Futures RequireHttps attribute?
我要prevent不安全的HTTP请求被发送到一个操作方法。我想自动重定向到HTTPS。
I want to prevent unsecured HTTP requests from being sent to an action method. I want to automatically redirect to HTTPS.
MSDN:
- RequireHttpsAttribute
- RequireHttpsAttribute Members
- RequireHttpsAttribute.HandleNonHttpsRequest Method
我如何使用此功能?
推荐答案
我的猜测:
[RequireHttps] //apply to all actions in controller
public class SomeController
{
//... or ...
[RequireHttps] //apply to this action only
public ActionResult SomeAction()
{
}
}
这篇关于ASP.NET MVC RequireHttps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文