I am having Home controller with default action as landing.
But for ErrorController default action should be index
In the RegisterRoutes method in Global.cs, I had written like this : -
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Landing", id = UrlParameter.Optional }
But when I am trying to redirect to error from Application_Error event : -
Exception error = Server.GetLastError();
string redirectUrl = "~/Error/id=" + errorId;
HttpContext.Current.Server.ClearError();
HttpContext.Current.Response.Redirect(redirectUrl);
it is throwing error - action landing not found.