<%
'*******************************************************************************************
' 创 建 人:cuiwl (longchengfy@hotmail.com)
' 更新时间:2006-11-14 10:11
' 说 明:生成静态页面
'*******************************************************************************************
class savefile
public foldername, filename, fileurl
public fso, stream, xmlhttp
public thiserror
private i, j
' 初试化
private sub class_initialize()
foldername = ""
filename = "savefile.htm"
set fso = server.createobject("scripting.filesystemobject")
set stream = server.createobject("adodb.stream")
dim xmlhttparr(3)
xmldocarr(0) = "msxml2.serverxmlhttp.6.0"
xmldocarr(1) = "msxml2.serverxmlhttp.5.0"
xmldocarr(2) = "msxml2.serverxmlhttp.4.0"
xmldocarr(3) = "msxml2.serverxmlhttp.3.0"
for i = 0 to ubound(xmldocarr)
xmldocstr = xmldocarr(i)
if isobj(xmldocstr) then exit for
next
erase xmldocarr
if objerr(xmldocstr) then
response.clear
rwrite thiserror
response.end
end if
set xmlhttp = server.createobject (xmldocstr)
end sub
private sub class_terminate()
if isobject(fso) then set fso = nothing
if isobject(stream) then set stream = nothing
if isobject(xmlhttp) then set xmlhttp = nothing
end sub
private function sco(byval objstr)
set sco = server.createobject (objstr)
end function
private function isobj(byval objstr)
dim testobj
on error resume next
set testobj = server.createobject (objstr)
if -2147221005 <> err then
isobj = true
else
isobj = false
end if
set testobj = nothing
err.clear
end function
private function objerr(byval objstr)
objerr = false
if not isobj(objstr) then
thiserror = objstr & "组件注册错误!"
objerr = true
end if
end function
' Html文件生成
public sub save()
dim filepath
dim binFileData
filepath = server.mappath(foldername & "/" & filename)
if not fso.folderexists(server.mappath(foldername)) and foldername <> "" then
fso.createfolder server.mappath(foldername)
end if
xmlhttp.open "GET",fileurl,false
xmlhttp.send()
binFileData = xmlhttp.responseBody
Stream.Type = 1
Stream.Open()
Stream.Write(binFileData)
Stream.SaveToFile FilePath, 2
Stream.Close()
end sub
End class
'*******************************************************************************************
%>