Hi, We have website hosted on discount asp.net and it is SSL restricted, now we want users should be redirected to https://website if user try to open http://website . Our idea was to modify error page in IIS for 403.4 to custom page which will redirect it to our website on https. We are developing the application in asp.net 2.0 and hosting company is suggesting to modify the code in asp.net to redirect to https. But the issue, is since user does not have access to any of the pages, and since IIS itself blocks the request, how it can be done through modification in web.config or code. Please let me know if my conception are wrong and the way to get things done programatically. regards, - sushant
You can have something like if (Request.Url.ToString().Contains('http://')) { Response.Redirect('https://yoursite.com'); } within your site's default page. Vikram DiscountASP.NET www.DiscountASP.NET Post Edited (vvsharma) : 4/3/2007 11:31:51 PM GMT
I recommend not using the IIS custom error configuration. Check out this blog that I found instead: http://weblogs.asp.net/kwarren/archive/2005/07/08/418541.aspx Aristotle DiscountASP.NET www.DiscountASP.NET
If you find that you would like to go back and forth between plan-text and secured pages on a regular basis (which would speed up your page load times since encrypted pages load slower because of the encryption) then you might visit http://www.codeproject.com/aspnet/WebPageSecurity_v2.asp#whatsnewand take a look at their module. I have used it in my pages and it works nicely. It was easy to implement and documented well. If your pages have a lot of graphics on them, or link back-and-forth between HTTP/HTTPS pages a lot, this can save you a lot of time. -Ken