7.5.2 Improving the URLs; Listing 7-24 Adding a New Route to the RouteConfig.cs File

chap07
Jason Zhu 2021-09-08 15:53:41 +10:00
parent 8d40247742
commit 226651bed4
1 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.UI;
namespace SportsStore.WebUI
{
@ -13,6 +14,12 @@ namespace SportsStore.WebUI
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: null,
url: "Page{page}",
defaults: new { Controller = "Product", action = "List"}
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",