Want to create a action filter to force Url to be using SSL

Posted by Blankman on Stack Overflow See other posts from Stack Overflow or by Blankman
Published on 2010-03-10T17:08:02Z Indexed on 2010/04/15 17:03 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

I want to create a action filter that will check the url, and if its not using Ssl, redirect to the same page but with SSL.

What is the best way of doing this?

Should I just check the RawUrl, and scan the string for https, and if its not there then do:

context.Response.Redirect(context.Request.RawUrl.Replace("http:", "https:"));

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about ASP.NET