Hi guys, now a days i m having hell a lot of trouble using routing infrastructure of asp.net mvc2. i have following routes registered in my global.asax file
routes.MapRoute(
"strict",
"{controller}.mvc/{docid}/{action}/{id}",
new { action = "Index", id = "", docid = "" },
new { docid = @"\d+"}
);
routes.MapRoute(
"default",
"{controller}.mvc/{action}/{id}",
new { action = "Index", id = "" },
new { docConstraint = new DocumentConstraint() }
);
the problem is with first route ("strict"). three kind of urls can match first route. mycontroller/23/myaction,mycontroller/23/myaction/12 or mycontroller/23/mvaction/stringid. if i try to use this route without specifying value of id everything works fine for example
Html.ActionLink("Link text", "ActionName", new{docid = 23});
every thing goes well. but if i use links like
Html.ActionLink("Link text", "ActionName", new{docid = 23, id = 223})
this will produce url currentcontroller.mvc/23/ActionName/223 that is absolutely correct but when it loads the page it gives javascript error in jquery1.4.2.min.js file. well this is strange. if i change id to someid =223 it will reflect in query string and there will be no js error; even stranger. can anyone help me in solving this annoying problem.
Edit: i have done some further debugging and found when both id and docid are mentioned in route values one thing is ignored in global.asax that is the ignore path
routes.RouteExistingFiles = false;
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.ignoreRoute is totally by passed and i can c names of js files in route value dictionary while debugging in my controller.
regards
adeel