Reputation: 1351
Is there a way to redirect the user to an error page (view) when an exception is raised in application_start method of global.asax? I get a Request object is null message when I try to do a redirect. How would i handle this? I have to raise the exception if certain conditions are not met and I want the user to go to a specific View.
My application is MVC3 based, btw.
Thanks
Upvotes: 1
Views: 2224
Reputation: 7243
You can refer this page.
The thing you are trying to do is possible via Web.config
Just show what page to load when http error 500 occurs.
Edit
Sorry gave wrong url
Upvotes: 0
Reputation: 887469
Application_Start
happens before ASP.Net starts processing the request.
You could set a global static flag to indicate the error condition, then handle BeginRequest
and check the flag and redirect.
Upvotes: 1