ASP.NET从缓存中删除页面

时间:2022-09-24 23:46:05

I have a web application with login in system, and basically keeps you logged in if a session is still set.

我有一个登录系统的Web应用程序,如果仍然设置会话,基本上会让您登录。

Basically the problem is after the user logs out(session is terminated and user redirected to the login page), you could still technically access the last page accessed if you retype the url but if you click on anything you are redirected to the login page.

基本上问题是在用户注销(会话终止并且用户重定向到登录页面)之后,如果您重新键入URL,您仍然可以在技术*问最后访问的页面但是如果您点击任何重定向到登录页面的内容。

This only happens in Internet Explorer and I assume this is occuring since the pages are being stored in the cache , is there a way fix this issue?

这只发生在Internet Explorer中,我认为这是因为页面存储在缓存中,有没有办法解决这个问题?

2 个解决方案

#1


You must use this code, this avoids the caching of the page:

您必须使用此代码,这可以避免页面的缓存:

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

#2


Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.CacheControl = "no-cache"
Response.Expires = -1

this code avoids the caching of page

此代码避免了页面的缓存

#1


You must use this code, this avoids the caching of the page:

您必须使用此代码,这可以避免页面的缓存:

Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

#2


Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.CacheControl = "no-cache"
Response.Expires = -1

this code avoids the caching of page

此代码避免了页面的缓存

相关文章