asp.net mvc - MVC Route not found although declared -
i got following routes declared:
routes.maproute( name: "surveycontent", url: "survey/{action}/{id}", defaults: new { controller = "contents", action = "list", id = 3, type = 3 } ); ); routes.maproute( name: "itemcreation", url: "{controller}/create", defaults: new { controller = "contents", action = "details", id = 0 } ); routes.maproute( name: "opencontent", url: "open/{code}", defaults: new { controller = "courses", action = "opencontent", code = "" } ); i trying access link localhost/survey/create, returns me 404 error. later on added
routes.maproute( name: "surveycontent1", url: "survey/create", defaults: new { controller = "contents", action = "details", id = 0, type = 3 } ); under surveycontent, didn't change anything. doing wrong?
the route:
url: "survey/{action}/{id}", will match survey/create, before:
url: "{controller}/create", so place itemcreation before surveycontent.
in route table, order matters.
Comments
Post a Comment