如何重定向已登录的用户尝试访问登录页面MVC3

时间:2013-06-03 16:04:15

标签: asp.net-mvc-3 form-authentication

我正在使用MVC3进行表单身份验证。除了一件事,一切都很好。我想在他/她再次尝试访问LogOn页面时将经过身份验证的用户重定向到另一个页面。那我怎么能实现这个呢?

1 个答案:

答案 0 :(得分:7)

在LogOn Action中执行类似的操作。

if (HttpContext.Request.IsAuthenticated)
{
   return RedirectToAction("Action", "Controller");
}

return View();
相关问题