[英]ASP.NET MVC RouteConfig - Changes Detecting Late
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) (例如:
localhost/123/Product_Name
在几小时后激活)
Thank you in advance for your help预先感谢您的帮助
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.应该做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.