Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在默认的 asp.net mvc 路由中,地址是这样的: http://domainname/Controllername/ActionName
我的问题是:我可以在之前的 URL 中对控制器名称和操作名称进行编码吗?
Use Action Name Attribute :
[ActionName("AnotherName")] public ActionResult Login() { return View("Login"); }
And, Your Route Will now
//localhost:11727/users/AnotherName
Instead :
//localhost:11727/users/Login