【发布时间】:2015-08-12 21:02:13
【问题描述】:
我有以下控制器
public class GlobalAdminController : Controller
{
// GET: GlobalAdmin
[AuthorizeUser(Roles = "admin")]
public ActionResult Index()
{
return View();
}
}
还有家庭控制器,它是应用程序的主要登录页面
public ActionResult Index()
{
if(User.IsInRole("admin"))
{
RedirectToAction("Index", "GlobalAdmin");
}
return View();
}
重定向到操作在调试器中执行 但是索引操作本身并未在全局管理员上执行
我想知道是否有更好的方法来做到这一点?也许通过路由?
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-5 asp.net-mvc-routing