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.
我创建了一个名为 Dashboard 的新控制器和一个名为 Index 的视图,上面写着 Hello Username。
在 MVC 中,我怎样才能使它只对登录用户可用?
您可以使用以下Authorize属性:
Authorize
[Authorize] public ActionResult Index() { }