SSL pages under ASP.NET MVC

前端 未结 12 1111
情话喂你
情话喂你 2020-11-28 01:49

How do I go about using HTTPS for some of the pages in my ASP.NET MVC based site?

Steve Sanderson has a pretty good tutorial on how to do this in a DRY way on Previe

12条回答
  •  一个人的身影
    2020-11-28 02:29

    MVCFutures has a 'RequireSSL' attribute.

    (thanks Adam for pointing that out in your updated blogpost)

    Just apply it to your action method, with 'Redirect=true' if you want an http:// request to automatically become https:// :

        [RequireSsl(Redirect = true)]
    

    See also: ASP.NET MVC RequireHttps in Production Only

提交回复
热议问题