3
我一直在试图让我的登录页面无法访问到已经登录的用户。他们宁愿被重定向到他们的仪表板,除非他们没有登录。阻止登录用户访问asp.net中的登录页面mvc 5
我已经做了以下,他们都没有工作。任何人都有解决方案吗?
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
if (Request.IsAuthenticated)
{
RedirectToAction("Index", "Dashboard");
}
ViewBag.ReturnUrl = returnUrl ?? Url.Action("Index","Dashboard");
return View();
}
这也太
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
if (User.Identity.IsAuthenticated)
{
RedirectToAction("Index", "Dashboard");
}
ViewBag.ReturnUrl = returnUrl ?? Url.Action("Index","Dashboard");
return View();
}
任何指导将不胜感激。谢谢