我想使用RequireHttpsAttribute来防止将不安全的HTTP请求发送到操作方法.
C#
[RequireHttps] //apply to all actions in controller
public class SomeController
{
[RequireHttps] //apply to this action only
public ActionResult SomeAction()
{
...
}
}
Run Code Online (Sandbox Code Playgroud)
VB
<RequireHttps()> _
Public Class SomeController
<RequireHttps()> _
Public Function SomeAction() As ActionResult
...
End Function
End Class
Run Code Online (Sandbox Code Playgroud)
不幸的是,ASP.NET Development Server不支持HTTPS.
如何在发布到生产环境时使我的ASP.NET MVC应用程序使用RequireHttps,而不是在ASP.NET Development Server上的开发工作站上运行时?