I am displaying a loading div on the page init using response.write and response.flush until the time page is fully rendered . like this:
Page.Response.Write(loadinghtmlstring);
Page.Response.Flush();
I am redirecting to error page if some error occurs through try catch.
try
{}
catch (WrapedException wre)
{
BaseUserControl.StoreException = wre;
Response.Redirect(base.ErrorPagePath, false);
}
catch (Exception ex)
{
BaseUserControl.StoreException = new WrapedException(ex.Message, ex);
Response.Redirect(base.ErrorPagePath, false);
}
Now if any error occurs on my page after displaying loading div I got error which says :
Cannot redirect after HTTP headers have been sent.