标题:生成静态页面类
只看楼主
做個簡單D朲
Rank: 1
等 级:新手上路
帖 子:34
专家分:0
注 册:2007-3-30
 问题点数:0 回复次数:0 
生成静态页面类

<%
'*******************************************************************************************
' 创 建 人: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
'*******************************************************************************************
%>

搜索更多相关主题的帖子: 静态页面 public longchengfy target 
2007-04-06 18:46



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-129806-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.467393 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved