Reputation: 171
I have an error page that uses a Master Page in .Net MVC3. The Master Page needs the controller for the error view to inherit from ApplicationController wich does some essential loading of data for the ViewModel used in the Master Page.
public class ErrorController : ApplicationController
{
public ActionResult Error()
{
return View();
}
}
But when the ApplicationController gets an error trying to load it's data, the Error page will also hang, because it is dependent on ApplicationController.
As I understand the problem, the best solution would be to have an alternate error page if the error occured in ApplicationController.
How would I set an alternate error page to be used if the error occurs in the ApplicationController?
Upvotes: 2
Views: 134
Reputation: 17380
You need to use a Global Error Handler, kind of like Global.asax. Here is a solution you can check out: http://blog.ploeh.dk/2009/12/01/GlobalErrorHandlingInASPNETMVC.aspx
Good luck!
Upvotes: 2