您好,欢迎来到点滴吧! 手机版
点滴吧www.diandiba.com
记录点点滴滴,尽在点滴吧
  • 文章
  • 文章
  • 特效
  • 素材
  • 景点
您现在的位置:首页 > ASP教程 > 文章正文
FSO 组件asp生成html静态页面碰到缓存、cookies解决方法
更新时间:2016/1/11 20:33:34   点击:7238次

在用fso组件,把asp文件生成html静态页面的时候,碰到一个问题,就是无论怎么更新内容,生成的页面都不变,应该随着asp页面变化而变化才对。 以下是源代码:


<% 

Function GetaspPage(url) 

dim Retrievalx

Set Retrievalx = CreateObject("Microsoft.XMLHTTP") 

With Retrievalx 

.Open "Get", url, False ', "", "" 

.Send 

GetaspPage = BytesToBstr(.ResponseBody)

End With 

Set Retrievalx = Nothing 

End Function


Function BytesToBstr(body)

dim objstream

set objstream = Server.CreateObject("adodb.stream")

objstream.Type = 1

objstream.Mode =3

objstream.Open

objstream.Write body

objstream.Position = 0

objstream.Type = 2

objstream.Charset = "GB2312"

BytesToBstr = objstream.ReadText 

objstream.Close

set objstream = nothing

End Function

 


on error resume next

Url="http://上海IT外包/"&"abc.asp?""

wstr = GetaspPage(Url)


Set fs=Server.CreateObject("Scripting.FileSystemObject")

If (fs.FileExists(server.MapPath("/default.htm"))) Then

fs.DeleteFile(server.MapPath("/default.htm"))

End If

Set CrFi=fs.CreateTextFile(server.MapPath("/default.htm"))

Crfi.Writeline(wstr)

set CrFi=nothing

set fs=nothing

response.write "...<font color=red>生成网站首页完成!</font><p>"

Response.write "<a href='http://上海IT外包' >上海IT外包</a>"


%>


以上代码中,将:

Url="http://上海IT外包/"&"abc.asp""

wstr = GetaspPage(Url)


改为:

Url="http://上海IT外包/"&"abc.asp?time="&now()

wstr = GetaspPage(Url)


即可解决这个问题


这个是HTTP的缓存造成的 

在Url="http://上海IT外包/"&"abc.asp"这个后面加一个随机参数就ok

上一篇:没有了   下一篇:asp实现长文章自动分页插件
相关文章
导航分类
热门文章
关于我们| 联系我们| 免责声明| 网站地图|
CopyRight 2012-2015 www.diandiba.com - 点滴吧 All Rights Reserved
滇ICP备09005765号-2