Friday, December 06, 2013

Routing

When adding custom routing in MVC, any custom routing must go BEFORE the default. For example:

public static void RegisterRoutes(RouteCollection routes)
  {
   routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
 
            routes.MapRoute(
                 name"Zing",
                 url"zing/{type}/{p}",
                 defaultsnew { controller = "zing"action = "Index"type = UrlParameter.Optional }
             );
 
   routes.MapRoute(
    name"Default",
    url"{controller}/{action}/{id}",
    defaultsnew { controller = "Home"action = "Index"id = UrlParameter.Optional }
   );
  }

No comments:

Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.

Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.

Z