MVC Handle 404s and set default error page
I'm tying to enable the default routing in MVC.

I want every 404 request to redirect to DefaultController DefaultRout()


I found http://stackoverflow.com/questions/310580/how-can-i-make-a-catch-all-route-to-handle-404-page-not-found-queries-for-asp-n

But {*url} dosen't work i'm getting 404 and not redirecting to the default page.

My code:


        public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.gif/{*pathInfo}");


        //http://localhost:4775/BW/A/Tasks
        routes.MapRoute("Pages", "A/{controller}", new { controller = "Tasks", action = "InitPage" });

  
        routes.MapRoute(
        "404-PageNotFound",
        "{*url}",
        new { controller = "Default", action = "DefaultRout" }
        );


    }



What am I missing?

Thanks 

Rafael


MVC Handle 404s and set default error page
===

I'm tying to enable the default routing in MVC.

I want every 404 request to redirect to DefaultController DefaultRout()


I found http://stackoverflow.com/questions/310580/how-can-i-make-a-catch-all-route-to-handle-404-page-not-found-queries-for-asp-n

But {*url} dosen't work i'm getting 404 and not redirecting to the default page.

My code:


        public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.ascx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.ashx/{*pathInfo}");
        routes.IgnoreRoute("{resource}.gif/{*pathInfo}");


        //http://localhost:4775/BW/A/Tasks
        routes.MapRoute("Pages", "A/{controller}", new { controller = "Tasks", action = "InitPage" });

  
        routes.MapRoute(
        "404-PageNotFound",
        "{*url}",
        new { controller = "Default", action = "DefaultRout" }
        );


    }



What am I missing?

Thanks 

Rafael

