Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 3 如何重定向试图访问登录页面MVC3的已登录用户_Asp.net Mvc 3_Form Authentication - Fatal编程技术网

Asp.net mvc 3 如何重定向试图访问登录页面MVC3的已登录用户

Asp.net mvc 3 如何重定向试图访问登录页面MVC3的已登录用户,asp.net-mvc-3,form-authentication,Asp.net Mvc 3,Form Authentication,我正在使用MVC3进行表单身份验证。除了一件事,一切都很好。当经过身份验证的用户再次尝试访问登录页面时,我想将其重定向到另一个页面。那么我如何才能做到这一点呢?在您的登录操作中,执行类似的操作 if (HttpContext.Request.IsAuthenticated) { return RedirectToAction("Action", "Controller"); } return View(); 它是HttpContext.Request.IsAuthenticated。谢

我正在使用MVC3进行表单身份验证。除了一件事,一切都很好。当经过身份验证的用户再次尝试访问登录页面时,我想将其重定向到另一个页面。那么我如何才能做到这一点呢?

在您的登录操作中,执行类似的操作

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

return View();

它是
HttpContext.Request.IsAuthenticated
。谢谢你的帮助,先生!