是否可以将参数从“url”部分传递给 MapRoute 的“默认”部分中的方法?
routes.MapRoute(
name: "Language",
url: "{language}/{controller}/{action}/{id}-{description}",
defaults: new { Controller = "Home", action = "Index", id = UrlParameter.Optional, language = UrlParameter.Optional, description = GetDescription(id) }
);
我可以在没有任何参数的情况下调用 GetDescription(),但我不知道如何从 url 传递参数,即。获取描述(ID)?