I'm making asp.net mvc application and I have next issue. For example I need produce url like this www.something.com/abc
where abc is product ID and www.something.com/def
where def is company ID.
Can someone show me some part of code with route link like this?
@Html.RouteLink("Sample link 1", "routeName 1",
new {controller = "Home", action = "action name 1", parameter="abc" })
@Html.RouteLink("Sample link 2", "routeName 2",
new {controller = "Home", action = "action name 2", parameter="def" })
Just to clarify more my question, for example:
this is routing system
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "aaaaa",
url: "{id}",
defaults: new { controller = "Home2", action = "Index2" }
);
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "bbbb",
url: "{id}",
defaults: new { controller = "Home3", action = "Index2" }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
And these are routelinks
@Html.RouteLink("bbbb", "aaaaa",new { id = 555 })
@Html.RouteLink("bbbb", "bbbb", new { id = 6666666, controller="Home3"})
And both of them are redirecting me to same action controller home2 and action Index2.
But I specified which route to use "aaaaa" for first and "bbbb" for secound
And I also specified different controller in second one.