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();
}
どれガイドが理解されるであろう。ありがとうございました