草庐IT

ASP.NET Mvc 5 返回带有 seo 友好 url 的 View

我正在寻找一种基于Id返回View的方法,但在返回时添加友好的url部分。我知道当我有可用的数据时,我可以传入ID和名称,例如通过使用:Url.Action("Index","Cat",new{id=model.ID,seoname=model.SEO});[AllowAnonymous][Route("Cat/{id?}/{seoname?}")]publicActionResultIndex(int?id=null,stringseoname=null){//dosomethingwithidandcreateviewmodel//incaseIgetredirectfromthe