I'm developing an ASP.NET application and when the user logs in and clicks the browser button to go back he can access the login / registration page, even though I do the verification of the user's key logged in to the session.
Here are the prints:
1 - I logged in
2-I'mloggedin,thesiteredirectsmetotheindexandIclickthebackbutton.
3-AfterthisIgobacktothelog/loginscreenwhichcannothappen:
Afterphoto3,ifIgobacktotheindex,Iamloggedinnormally,topreventthisIdidacheckinthecontrollercheckingiftheuserisloggedinornot,ifyesitgoesbacktotheindex,howeverwhentheuserclicksbackitlookslikethebrowserthatdoesthiscontrol.Ihaveseensitesthatdoesnotallowyoutogobackontheloginscreen,doesanyoneknowhowtosolvethis?Hereisthecheckinthecontroller:
publicActionResultLoginRegister(){if(Session["UserStatus"] != null)
{
return RedirectToAction("Index", "Home");
}
return View();
}
[HttpPost]
public ActionResult LoginRegister(string fr,string t,string ReT)
{
if (Session["UserStatus"] != null)
{
return RedirectToAction("Index", "Home");
}
//Validação e outros processos.
}