1
我有以下网址:ASP.NET MVC路由帮助
http://localhost/About
http://localhost/Contact
http://localhost/Shop
http://localhost/Shop/ListProducts/{CategoryID}/{CategoryName}
http://localhost/Shop/Checkout
http://localhost/Customer
http://localhost/Customer/Edit
http://localhost/Customer/ChangePassword
http://localhost/Authentication/LogOn
http://localhost/Authentication/LogOff
与以下地图:
routes.MapRoute("Authentication", "Authentication/{action}", New With {.controller = "Authentication", .action = "Index"})
routes.MapRoute("Customer", "Customer/{action}", New With {.controller = "Customer", .action = "Index"})
routes.MapRoute("Shop", "Shop/{action}/{CategoryID}/{CategoryName}", New With {.controller = "Shop", .action = "Index", .CategoryID = UrlParameter.Optional, .CategoryName = UrlParameter.Optional})
routes.MapRoute("Main", "{action}", New With {.controller = "Main", .action = "Index"})
routes.MapRoute("Default", "{controller}/{action}/{id}", New With {.controller = "Main", .action = "Index", .id = UrlParameter.Optional})
虽然这似乎是工作,我需要一种方法来处理未知路线/网址与404.
我看过几个样本在这里,并不能'让他们工作。
另外,这些路线看起来不错吗?我在正确的轨道上吗?
谢谢