I’m having some troubles when trying to use routes in ASP.NET MVC 3.
I’m in this URL:
mysite/InitialPage/123456 <- partner ID
Routing it…
routes.MapRoute(
"InitialPageRoute",
"InitialPage/{partnerID}",
new { controller = "InitialPage", action = "Index" }
);
OK, it works fine.
When I put a Html.ActionLink to redirect to another page…
@Html.ActionLink("Another copy of some bill", "CopyOfBill", "Payment", new { partnerID = ViewBag.PartnerID })
And routing this way…
routes.MapRoute(
"CopyOfBillRoute",
"Payment/CopyOfBill/{partnerID}",
new { controller = "Payment", action = "CopyOfBill" }
);
And doesn’t work.
Anyone have any idea?
Thanks!!!
It might be best to use a
RouteLinkin this case (name the route explicitly), since both the controller and action are hard-coded.