I develop an ASP.NET MVC application. I would like to redirect user to error page if an error is occured. But if the error occured when the application is initializing I can not redirect user because "Response is not available in this context". Руку is my code:
protected void Application_Start()
{
//...
throw new Exception("qwerty");
}
protected void Application_Error(object sender, EventArgs e)
{
// Here I have got an HttpException with message
// "Response is not available in this context"
HttpContext.Current.Response.RedirectToRoute("Default");
}
Is there way to redirect user to error page if the error occured when Application was initializing?