[CODE][ASP]生成静态页的最终类
[ yms123 发表于 2007-4-11 9:25:00 ]
Class MarkHTML
Private mUrlStr'网页的URL地址
Private mTemplateBody'模板文件替换后的HTML代码
Private mFilePath'生成网页的文件路径
Private mFileName'生成网页的文件名 '类初始化过程
Private Sub Class_Initialize
mUrlStr=""
mTemplateBody=""
mFilePath=""
mFileName=""
End Sub
'FSO方法生成网页
Public Function FSOMetHod()
Dim FSO,wFSO
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
Set wFSO=FSO.CreateTextFile(FilePath&FileName)
wFSO.Write mTemplateBody
wFSO.Close
Set wFSO=Nothing
Set FSO=Nothing
End Function
'XMLHttp方法生网页
'参数生成模式FSO,ADOStream
Public Function XMLHttpMetHod(MarkMode)
Dim XMLHttp
Set XMLHttp=Server.CreateObject("Microsoft.XMLHTTP")
XMLHttp.Open "Get",mUrlStr,False
XMLHttp.Send
mTemplateBody=XMLHttp.responseHTML
Select Case MrakMode
Case "FSO"
FSOMetHod
Case "ADOStream"
ADOStreamMetHod
End Select
Set XMLHttp=Nothing
End Function
'ADODB.Stream方法生成网页
Public Function ADOStreamMetHod()
Dim oStream
Set oStream=Server.CreateObject("ADODB.Stream")
oStream.Type=1
oStream.Open
oStream.Write mTemplateBody
oStream.SaveToFile FilePath&FileName,2
oStream.Close
Set oStream=Nothing
End Function
'属性过程
Public Property Let FileName(vData)
mFileName=vData
End Property
Public Property Get FileName()
FileName=mFileName
End Property
Public Property Let FilePath(vData)
mFilePath=vData
End Property
Public Property Get FilePath()
FilePath=mFilePath
End Property
Public Property Let UrlStr(vData)
mUrlStr=vData
End Property
Public Property Get UrlStr()
UrlStr=mUrlStr
End Property
Public Property Let TemplateBody(vData)
mTemplateBody=vData
End Property
Public Property Let TemplateBody()
TemplateBody=mTemplateBody
End Property
End Class[/CODE]
以前写的楼主可以参考一下。