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 MVC2 应用程序。我有登录页面,只有一个带有表格的页面。带有表格的页面在用户登录后显示。如果他试图去,在登录页面上重定向用户的最佳方法是什么现在在桌子上吗?
尝试将 [Authorize] 属性放在控制器的顶部
[Authorize] public class HomeController: Controller { public ActionResult YourTable() { return View(); } }
或者在您的操作的顶部:
public class HomeController: Controller { [Authorize] public ActionResult YourTable() { return View(); } }