My site is running in IIS 7 and sometimes after an error is thrown I actually see my error page but other times I get the typical asp.net YSOD. Even though the address to the page is actually showing the same address in the address bar as if the correct error page is actually visible.
There is no rhyme or reason to the frequency of this happening. I can restart the web site and it doesn't seem to be affected. Once the correct error page is shown, it will keep being shown for quite a while. Then randomly the YSOD will be shown two to three times until finally the correct one is shown again.
Re: web.config customErrors defaultRedirect not always redirecting
If this is not code related(you override something in code) then maybe it's IIS7 related but the thing is i will be using IIS7 in a month or so and i cannot test something now.
did you looked here? http://stackoverflow.com/questions/2...alt-error-page
Re: web.config customErrors defaultRedirect not always redirecting
Originally Posted by sapator
If this is not code related(you override something in code) then maybe it's IIS7 related but the thing is i will be using IIS7 in a month or so and i cannot test something now.
did you looked here? http://stackoverflow.com/questions/2...alt-error-page
In the post that's similar to my problem except it doesn't happen to me all the time. It looks like they never solved the problem so it isn't much help.
Re: web.config customErrors defaultRedirect not always redirecting
Originally Posted by brin351
try adding a root path to the error page.
Code:
defaultRedirect="~/Error.htm" >
That is if error.htm is in the root of the website.
Resolving it to the root didn't help but I've found how to reproduce the problem. When I change <customErrors mode="On" defaultRedirect="~/Error.htm"> mode to Off or RemoteOnly and throw an error in Application_Start, I see the full detailed asp error page as I would expect. If I change it back to on and refresh the site I get the stripped down asp error page shown in the image below.
I've done up to 10 or 15 quick refreshes or hit the site in new tabs and I'll finally see the custom error page. It's as if there's a 15 to 20 second lag before the custom error page is shown.
Re: web.config customErrors defaultRedirect not always redirecting
Sorry, I currently have my win7 x64 dev machine setup as an IIS 7.0 server where the site is hosted. I'm not able to test on a remote server at the moment.
Re: web.config customErrors defaultRedirect not always redirecting
Sounds good. Depending on the software you are using, once you have everything setup, make sure you take a snapshot, that way you can rollback to the start if you need to.
Re: web.config customErrors defaultRedirect not always redirecting
Originally Posted by gep13
Sounds good. Depending on the software you are using, once you have everything setup, make sure you take a snapshot, that way you can rollback to the start if you need to.
Gary
I've used a snapshot several times before and saved a lot of hassle but I forgot this time. Thanks for the reminder!