Skip to content

Instantly share code, notes, and snippets.

@snippe
Created December 31, 2014 03:36
Show Gist options
  • Save snippe/64bf50bb8a4288d3b3bd to your computer and use it in GitHub Desktop.
Save snippe/64bf50bb8a4288d3b3bd to your computer and use it in GitHub Desktop.
Registering routes in Global.asax
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
}
protected void Application_Start()
{
RegisterRoutes(RouteTable.Routes);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment