Reputation: 13
I am using dynamic routeconfig:
foreach (var urn in db.Urunler.Where(x => x.UrunKategori.DilId == item.Id).ToList())
{
routes.MapRoute(
name: "Urun" + urn.Id,
url: @urn.Id + "/" + @urn.UrnUrl,
defaults: new { controller = "Urunler", action = "Detay", id = @urn.Id }
);
}
But these urls are not valid for a long time. (Example: localhost/123/Product_Name
activates after a few hours)
Thank you in advance for your help
Upvotes: 0
Views: 41
Reputation: 1680
Yeah you can just have one router
routes.MapRoute(
name: "MyUrlRouter",
url: "{id}/{url}",
defaults: new { controller = "Urunler", action = "Detay", id = UrlParameter.Optional }
);
Should do.
Upvotes: 0