登录和注销后MVC 6中的“后退"按钮问题 [英] Back button issue in MVC 6 after login and logout

查看:78
本文介绍了登录和注销后MVC 6中的“后退"按钮问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图限制用户在登录/注销到应用程序后单击后退按钮.

如果用户已登录到应用程序,则在单击后退按钮后不应显示登录"视图,如果用户从应用程序中注销,则应不显示后退按钮.

我已经使用了缓存技术,该技术以链接数给出,但是似乎不起作用.

CacheAfterLogout 链接并按原样完成,仍然是问题没有解决.我正在使用asp.net身份框架.

有人可以帮忙吗?

解决方案

要禁用缓存,您可以将以下内容应用于希望禁用缓存的每个控制器

[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]

您还可以设置命名的缓存配置文件并配置运行时设置.

I am trying to restrict user to click back button after Login/Logout into the application.

If the user is logged in into the application, then after clicking on back button Login view should not be displayed and if user is logged out from the application then clicking on back button LogOff view should not be displayed.

I have already used caching technique which is given in number of links, but seems its not working.

This CacheAfterLogout link and done exactly as it is, still problem is not solved. I am using asp.net identity framework.

Could someone help on this ?

解决方案

To disable caching you can apply the following to each controller you wish to disable caching on

[ResponseCache(Location = ResponseCacheLocation.None, NoStore = true)]

You can also setup named cache profiles and configure the settings at runtime.

这篇关于登录和注销后MVC 6中的“后退"按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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