Is there a command in classic ASP I can use to tell the browser not to pull the page from it's cache, or, to not cache, or clear the cache of my page?
我是否可以使用经典ASP中的命令告诉浏览器不要从其缓存中提取页面,或者不缓存或清除页面缓存?
7 个解决方案
#1
9
You can use HTML meta tags:
您可以使用HTML元标记:
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Fri, 01 Jan 1999 1:00:00 GMT" />
<meta http-equiv="Last-Modified" content="0" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
Or you can use ASP response headers:
或者您可以使用ASP响应标头:
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
#2
2
Here is a good article on how to do it across browsers.
这是一篇关于如何跨浏览器执行此操作的好文章。
http://www.htmlgoodies.com/beyond/reference/article.php/3472881
#3
2
Not asp related, this is a HTTP question. You do it by modifying some aspect of http caching like Cache-Control, etag, Expires etc. Read RFC2616 especially Caching in HTTP and set the appropriate header.
与asp无关,这是一个HTTP问题。您可以通过修改http缓存的某些方面来实现,如Cache-Control,etag,Expires等。阅读RFC2616,尤其是HTTP中的缓存并设置适当的标头。
#4
2
Ignore everybody telling you to use <meta>
elements or Pragma
. They are very unreliable. You need to set the appropriate HTTP headers. A good tutorial on how to decide which HTTP headers are appropriate for you is available here. Cache-Control: no-cache
is probably all you need, but read the tutorial as there are many project-specific reasons why you might want something different.
忽略所有人告诉你使用 元素或Pragma。它们非常不可靠。您需要设置适当的HTTP标头。此处提供了有关如何确定适合您的HTTP标头的详细教程。缓存控制:无缓存可能就是您所需要的,但请阅读教程,因为有许多项目特定的原因,您可能需要不同的东西。
#5
0
If you put
如果你放
Response.Expires = -1
in you classic ASP-page it will instruct the browser not to cache the contents. If the user clicks "back" or navigating to the page in another way, the browser will refresh the page from the server.
在你经典的ASP页面中,它会指示浏览器不要缓存内容。如果用户单击“返回”或以其他方式导航到该页面,则浏览器将从服务器刷新页面。
#6
-1
Can be done by making sure that you have correct values set for Reponse.cachecontrol, response.expires etc according to your need. This link may be helpful in understanding what they mean. http://aspjavascript.com/lesson07.asp
可以通过确保根据需要为Reponse.cachecontrol,response.expires等设置正确的值来完成。此链接可能有助于理解它们的含义。 http://aspjavascript.com/lesson07.asp
#7
-2
Because of the way that different browsers handle caching both the Expires and the no-cache commands need to be used. Here is an article showing the correct way to do this.
由于不同浏览器处理缓存的方式,需要使用Expires和no-cache命令。这篇文章显示了正确的方法。
#1
9
You can use HTML meta tags:
您可以使用HTML元标记:
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="Fri, 01 Jan 1999 1:00:00 GMT" />
<meta http-equiv="Last-Modified" content="0" />
<meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
Or you can use ASP response headers:
或者您可以使用ASP响应标头:
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
#2
2
Here is a good article on how to do it across browsers.
这是一篇关于如何跨浏览器执行此操作的好文章。
http://www.htmlgoodies.com/beyond/reference/article.php/3472881
#3
2
Not asp related, this is a HTTP question. You do it by modifying some aspect of http caching like Cache-Control, etag, Expires etc. Read RFC2616 especially Caching in HTTP and set the appropriate header.
与asp无关,这是一个HTTP问题。您可以通过修改http缓存的某些方面来实现,如Cache-Control,etag,Expires等。阅读RFC2616,尤其是HTTP中的缓存并设置适当的标头。
#4
2
Ignore everybody telling you to use <meta>
elements or Pragma
. They are very unreliable. You need to set the appropriate HTTP headers. A good tutorial on how to decide which HTTP headers are appropriate for you is available here. Cache-Control: no-cache
is probably all you need, but read the tutorial as there are many project-specific reasons why you might want something different.
忽略所有人告诉你使用 元素或Pragma。它们非常不可靠。您需要设置适当的HTTP标头。此处提供了有关如何确定适合您的HTTP标头的详细教程。缓存控制:无缓存可能就是您所需要的,但请阅读教程,因为有许多项目特定的原因,您可能需要不同的东西。
#5
0
If you put
如果你放
Response.Expires = -1
in you classic ASP-page it will instruct the browser not to cache the contents. If the user clicks "back" or navigating to the page in another way, the browser will refresh the page from the server.
在你经典的ASP页面中,它会指示浏览器不要缓存内容。如果用户单击“返回”或以其他方式导航到该页面,则浏览器将从服务器刷新页面。
#6
-1
Can be done by making sure that you have correct values set for Reponse.cachecontrol, response.expires etc according to your need. This link may be helpful in understanding what they mean. http://aspjavascript.com/lesson07.asp
可以通过确保根据需要为Reponse.cachecontrol,response.expires等设置正确的值来完成。此链接可能有助于理解它们的含义。 http://aspjavascript.com/lesson07.asp
#7
-2
Because of the way that different browsers handle caching both the Expires and the no-cache commands need to be used. Here is an article showing the correct way to do this.
由于不同浏览器处理缓存的方式,需要使用Expires和no-cache命令。这篇文章显示了正确的方法。