asp.net mvc routing id parameter

前端 未结 6 893
自闭症患者
自闭症患者 2020-12-29 07:04

I am working on a website in asp.net mvc. I have a route

routes.MapRoute(
    \"Default\", // Route name
    \"{controller}/{action}/{id}\", // URL with pa         


        
6条回答
  •  死守一世寂寞
    2020-12-29 07:43

    You could either rename the parameter in the default root (which probably is not a good idea) or rename it in the action method. Adding another root will not help because it will be the same as the default one and given an url the routing engine cannot distinguish between the two and will always take the first one in the list.

提交回复
热议问题