ASP.NET MVC routing with one mandatory parameter and one optional parameter?

后端 未结 3 1922
南方客
南方客 2021-01-04 07:07

I\'ve been working on a large MVC application over the past month or so, but this is the first time I\'ve ever needed to define a custom route handler, and I\'m running into

3条回答
  •  时光取名叫无心
    2021-01-04 07:32

    hi you create your rout like this i think this will hep you

    routes.MapRoute(
                    "Regis", // Route nameRegister
                    "Artical/{id}", // URL with parameters
                    new { controller = "Artical", action = "Show", id = UrlParameter.Optional } // Parameter defaults
                );
    

提交回复
热议问题