我有控制器名称:区域和操作名称:Incharges但我希望URL是这样的(带有一些paremeter的动作名称)
www.example.com/district/incharges/aaa
www.example.com/district/incharges/bbb
www.example.com/district/incharges/ccc
但是,调试teamName时总是在action参数中返回NULL.
路由
routes.MapRoute( name: "Default",url: "{controller}/{action}/{id}",defaults: new { controller = "Home",action = "Index",id = UrlParameter.Optional } ); routes.MapRoute( "districtDetails","district/Incharges/{teamName}",new { controller = "district",action = "Incharges" } );
调节器
但是,调试teamName时总是在action参数中返回NULL.
public class districtController : Controller { public ActionResult Incharges(string teamName) { InchargePresentationVM INPVM = new InchargePresentationVM(); INPVM.InitializePath(teamName,string.Empty); return View("",INPVM); } }
视图
@{ ViewBag.Title = "Index"; } <h2>Index About</h2>
解决方法
原文地址:https://www.jb51.cc/aspnet/247705.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。