0
votes

In ASP.NET MVC, I need to route any error requests to my custom page, can I use this way?

routes.MapRoute(
"Default", // Route name
"{*pathInfo}", 
new { controller = "Home", action = "NotFound" } 
);

And, are there any better way to implement this?

2

2 Answers

0
votes

In the global.asax:

  public static void RegisterGlobalFilters(GlobalFilterCollection filters)
  {
        filters.Add(new HandleErrorAttribute() { View = "YourView" });
  }