public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Zing", url: "zing/{type}/{p}", defaults: new { controller = "zing", action = "Index", type = UrlParameter.Optional } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); }
Friday, December 06, 2013
Routing
When adding custom routing in MVC, any custom routing must go BEFORE the default. For example:
Tuesday, December 03, 2013
ToTitleCase method
The following lets you format a whole string in Title format; for example 'the news today' becomes 'The News Today' when applied.
string val = new CultureInfo("en-GB", false).TextInfo.ToTitleCase(val as String);
Subscribe to:
Posts (Atom)
Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.
Blog Archive
Fixes to common .NET problems, as well as information on .NET features and solutions to common problems that are not language-specific.