I have asp.net custom errors and they are working great:
<customErrors mode="RemoteOnly" defaultRedirect="~/Error/Index/500">
<error statusCode="403" redirect="~/Error/Index/403" />
<error statusCode="404" redirect="~/Error/Index/404" />
<error statusCode="500" redirect="~/Error/Index/500" />
<error statusCode="502" redirect="~/Error/Index/502" />
<error statusCode="503" redirect="~/Error/Index/503" />
<error statusCode="504" redirect="~/Error/Index/504" />
</customErrors>
Also, the ssl certificate has been successfully installed and my site is accessible just fine from both http and https.
Issue came about when I got a requirement to require SSL. The http link to the site has already been distributed to 1000 users. So we need any traffic going to the http address to be gracefully redirected to the https home page.
Any solution I've tried to get the redirect working breaks the custom errors.
I have this test url that generates an error to test my custom error pages at ~/error/test. It shows my custom error page using the mvc layout.
No matter how I set it up, once I turn on Require SSL within the SSL Settings in IIS, if I turn on any http custom errors (so that the 403.4 redirect is enabled), it doesn't even try to show my custom 500 page. It shows the generic http 500 page.
I want 403.4 handled at http level with a redirect and 500 to be handled at the asp.net level with my custom error page. Which incidentally is not a page but a controller that uses the .net exception which is in a session variable.
How can I accomplish this?