简体   繁体   中英

ASP.net: Cache doesn't clear when backward to registration page after redirect to welcome page and user successfully logged-in

User first go through registration and then after successful registration, user redirects to welcome page. At welcome page user successfully logged-in the website. But if someone click the back browser button then the previous registration page doesn't show any log-in user. And when we refresh that page then it shows user login. May be the reason that without refreshing the page it doesn't reload itself with cookies(login session). We want that either user can't go backward or if it go backward to registration page then the webpage already has details of login session. We are developing in MVC-Asp.NET

Please guide. Thanks in advance.

Add these attributes on your registration action method like.

[HttpGet]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] 
public ActionResult registration()
{
  //your code here
}

SOURCE: Handling browser back button

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM