I'm using [RequireHttps]
to force user to browse particular pages only on https. This works great but it has one issue. Once user navigates to another page it still has https. I want https browsing for only few pages.
How to redirect user from Https to http? Is it possible using RedirectToAction()
method?

- 6,300
- 18
- 72
- 111
-
Related question applicable to MVC 2: http://stackoverflow.com/questions/2560615/redirect-away-from-https-with-asp-net-mvc-app – Adam Lear Dec 21 '11 at 04:42
2 Answers
A better question would be why would you want the user to revert back to http when all the hard work of the hand-shaking as already been done so the overhead of using https over http is almost non-existent.
Have a look at this question
But answering your question, there is no implementation in MVC to do that, you'll have to do it yourself.
Have a look at this question, it describes how to do what you want.
-
11A good reason to redirect from HTTPS to HTTP is because the page will be embedding third party content which you do not have control over and you do not know whether it will be secured or not. Embedding unsecured content on a secured page can cause it to break. – jmacinnes Dec 26 '11 at 22:09
Sometimes this is a necessary evil. We have to redirect to a HTTP page from within our HTTPS app because the Epson ePOS Printer we are talking to has no HTTPS endpoint to expose its script through.
There were workarounds for this in Chrome post v38 when the mixed content blocking was enforced, but as of Safari in iOS9 we had to redirect specific pages to be served via HTTP and then upon leaving them redirect back to HTTPS for the rest of the site.
Again, its not great, but sometimes you need to be pragmatic about these things.

- 5,610
- 2
- 28
- 23