相关疑难解决方法(0)

ASP.NET MVC RequireHttps仅适用于生产

我想使用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上的开发工作站上运行时?

asp.net-mvc ssl https visual-studio

121
推荐指数
6
解决办法
4万
查看次数

标签 统计

asp.net-mvc ×1

https ×1

ssl ×1

visual-studio ×1