ASP.net:重定向到欢迎页面后,当用户成功登录后,返回注册页面时,缓存不会清除 [英] ASP.net: Cache doesn't clear when backward to registration page after redirect to welcome page and user successfully logged-in

查看:53
本文介绍了ASP.net:重定向到欢迎页面后,当用户成功登录后,返回注册页面时,缓存不会清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用户首先进行注册,然后成功注册后,用户将重定向到欢迎页面.用户在欢迎页面上成功登录了网站.但是,如果有人单击后退浏览器按钮,则上一个注册页面不会显示任何登录用户.当我们刷新该页面时,它将显示用户登录名.这可能是不刷新页面而不会用cookie(登录会话)重新加载自身的原因.我们希望用户不能后退,或者如果用户后退到注册页面,则该网页已经具有登录会话的详细信息.我们正在MVC-Asp.NET中开发

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

请指导.预先感谢.

推荐答案

将这些属性添加到您的注册操作方法之类.

Add these attributes on your registration action method like.

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

来源:处理浏览器后退按钮

这篇关于ASP.net:重定向到欢迎页面后,当用户成功登录后,返回注册页面时,缓存不会清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆