也许我以错误的方式处理这个问题,应该在动作过滤器中做所有事情,在这种情况下,请指出我正确的方向!
我正在设置我的 ASP.NET MVC 应用程序,以便一个 HomeController Index 操作提供两种不同类型的内容,如下所示:
if(Request.IsAuthenticated)
return View("IndexRegistered");
else
return View("IndexGuest");
这很好,但我想把它分成三个,这样管理员成员就有自己的页面......
if(Request.IsAuthenticated)
{
if( /* user is a member of administrators */)
return View("IndexAdministrator");
else
return View("IndexCustomer");
}
else
return View("IndexGuest");
有人可以告诉我这个难题的缺失部分吗?