日期:2014-05-17  浏览次数:20765 次

动态网页,如何不缓存页面
HTML code
<%     
  Response.Buffer   =   True     
  Response.ExpiresAbsolute   =   Now()   -   1     
  Response.Expires   =   0     
  %>
<% 
web=request.Form("selname2")
webs=split(web,",")
%>
<%
Dim paths,fso,objFolder,file,foldFiles,mm
url = "/fujitec1/" 
paths="imagin/" & webs(0) & "/" &webs(1) '图片文件所在的文件夹
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder(Server.MapPath(paths))
Set foldFiles = objFolder.files
i=1
For Each file In foldFiles
imagin=split(file,"\")
files=imagin(ubound(imagin))
urls=url &"/" &paths & "/" & files
response.write "<td><a href='"&urls&"'>"&files&"<br><br></td>"
Next
Set objFolder=nothing
Set objSubFolders=nothing
Set foldFiles=nothing
Set fso=nothing
%>

上面的代码是读取文件夹下的图片,现在问题是当我改动图片(小改动时),
第二次打开时还是缓存里的图片,如何解决这个问题了,谢谢。

------解决方案--------------------
使用random生成随机数加在url中试试
------解决方案--------------------
<meta http-equiv="expires" content="0">
------解决方案--------------------
meta不知道放在哪??

放在
<head>
<meta>
<title>
------解决方案--------------------
提交页面的时候,挂个时间参数.

比如 a.asp?t=<%=now()%>
------解决方案--------------------
正常情况不需要加任何代码的,输出页面只要与之前不同,就不会读取缓存的。asp动态元素更是如此。
实在不行试下10楼的方法。