Im trying to do something like this:
routes.MapRoute("Product", "{product}/{id}",
new
{
action = "Product",
controller = "Home",
product = UrlParameter.Optional,
id = UrlParameter.Optional
});
It gives me error when im trying to load page 404 i think, Im trying to make the url look like this: www.tables.com/productName/ID . How can i do it without adding a strong type word like this:
routes.MapRoute("Product", "Products/{product}/{id}", ... )
rest of the routes:
routes.MapRoute("Product", "{product}/{id}",
new
{
action = "Product",
controller = "Home",
product = UrlParameter.Optional,
id = UrlParameter.Optional
});
routes.MapRoute("Category", "Category/{category}/{template}",
new
{
action = "Index",
controller = "Category",
category = UrlParameter.Optional,
template = UrlParameter.Optional
});
routes.MapRoute("Profile", "Profile/{fullName}",
new
{
action = "Index",
controller = "Profile",
fullName = UrlParameter.Optional
});
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
thanks.