15.3 Creating and Registering a Simple Route; Listing 15.7 Registering a Route in RouteConfig.cs file
This commit is contained in:
parent
9b99afe3d3
commit
a5503a177b
@ -11,13 +11,8 @@ namespace UrlsAndRoutes
|
|||||||
{
|
{
|
||||||
public static void RegisterRoutes(RouteCollection routes)
|
public static void RegisterRoutes(RouteCollection routes)
|
||||||
{
|
{
|
||||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
Route myRoute = new Route("{controller}/{action}", new MvcRouteHandler());
|
||||||
|
routes.Add("MyRoute", myRoute);
|
||||||
routes.MapRoute(
|
|
||||||
name: "Default",
|
|
||||||
url: "{controller}/{action}/{id}",
|
|
||||||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user