I\'ve read
How to easily redirect if not authenticated in MVC 3? and Redirect to AccessDenied page when user is not authorized but the link from an answer (means h
I like Mark's Answer,
but I don't want to change all of my action attributes
from [Authorize] to [CustomAuthorize]
I edit Login() action on AccountController
and check Request.IsAuthenticated before show view
I think, if the authenticated user go to /Account/Logon,
I will redirect to /Error/AccessDenied.
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
if (Request.IsAuthenticated)
{
return RedirectToAction("AccessDenied", "Error");
}
ViewBag.ReturnUrl = returnUrl;
return View();
}