When the links are generated Code is in the Indexx of the controller.
So the Link Are Generated in this form
Wk/Index/XX/YYYY
The url Code is
url = urlHelper.RouteUrl("Wk", new { slug});
But i need the link will Be in This form
Wk/C/XXX
Here c is the other Action name
How can this be achieved.
My Global Asax Looks like
routes.MapRoute(
"Default", // Route name
"{controller}/{id}", // URL with parameters
new { controller = "Home", action = "Index" , id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Wk", // Route name
"{controller}/{action}/{slug}/{id}", // URL with parameters
new { controller = "Wk", action = "c", slug = "", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Book", // Route name
"{controller}/{id}/{pageNo}", // URL with parameters
new { controller = "Book", action = "Index",id = UrlParameter.Optional,pageNo = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"UserArea", // Route name
"{controller}/{slug}/{id}", // URL with parameters
new { controller = "UserArea", action = "Index", slug = UrlParameter.Optional, id = UrlParameter.Optional } // Parameter defaults
);
Try like this: