Need to redirect to error page if there is an occur occured in asp.net application
Posted on 2011-09-16
I have a requirement where I need to redirect the user to error page if there is an error occurred in application.
Error may be any kind of thing, whether it is Session time out exception Or page not found exception.
For this, I used custom errors setting in web.config file. My custom error file is in Root folder of the application.
I tested the following scenario in my application:
I set the session time out as 1 minute in web.config file. I ran my application. I waited for 1 minute and came back to application and clicked a button on my application. It is unable to go to my custom page. The problem I found is "custom page is content page for Master page in which a session is already initiated. " So, as already session is expired, it is unable to go to that page.
Then I tested using some public website, Google.com. It is redirected successfully.
So here my question is:
Do I need to give a separate URL which are not in same project to redirect the user
Can't we have the file added in my project as a separate file instead of having it as a content page ?
I tried it by adding a page as a separate page. that too did not work.
Please solve this problem guys ?