Minggu, 05 September 2010

How to switch between HTTP and HTTPS in ASP.NET MVC2

ASP.NET MVC2 has the new RequireHttpsAttribute that you can use to decorate any action to force any non-secure request to come through HTTPS (SSL).  It can be used as simply as this:        [RequireHttps]        public ActionResult LogOn()        {        .....        } Now any request to the LogOn action that is not over HTTPS will automatically be redirected back to itself over HTTPS.  

Tidak ada komentar:

Posting Komentar