Hello,
I have error handling in Application_Error event of globals.asax file. Inside this event, I'm using Response.Redirect(~errorview.aspx)
method, for redirection to site which is able to handle errors in user friendly way.
Everything works fine, unless exception is rising in Application_Start event. When error occurs there, my application gets trapped in infinite loop with the Application_Error method hit repeatedly. What is more, the page I'm redirecting to never gets hit. Changing Response.Redirect(~errorview.aspx)
method to Response.Redirect(~errorview.aspx, false)
changes nothing.
The good news is, when Response.Redirect(~errorview.aspx)
has been replaced with Server.Transfer(~errorview.aspx)
, errorview.aspx page succesfully gets hit.
The side effect now is not loading CSS, and errorview.aspx page looks ugly. What is more, the CSS is not loaded only when exception occurs in Application_Start event. Exceptions thrown from any other place don't make the CSS mess.
How I can handle this problem in correct way, and why the CSS is missing in the one particular situation ? What is the appropriate way of handling errors in my case ?
UPDATE
For CSS loading, I'm using this:
<link href="~/Css/Layout/style.css" type="text/css" rel="stylesheet"
runat="server" ID="_uid" />
error page I'm transfering from: http://localhost/APP/Pages/Module/Pages/ErrorView.aspx
css folder path: http://localhost/APP/Pages/Module/CSS/Layout/style.css
Thanks for any clues in advance. Regards.