在网上看到的生成静态页的方法。 很是简单有效。发上来共享一下。。
暂时只支持单个静态页,如需要批量生成,只要把这段改成函数来调用即可。
admin_fso.asp
dim strUrl,Item_Classid,id,FileName,FilePath,Do_Url,Html_Temp
s_File = Request("file") '传入文件名参数
If s_File = "" Then
s_File = "index.asp"
End If
FileName = Replace(s_File,"asp","htm")
FilePath = Server.MapPath("../")&"\"&FileName '设置静态页路径(我的是在主目录下建的admin文件夹)
Do_Url = "http://"
Do_Url = Do_Url&Request.ServerVariables("SERVER_NAME")&Replace(Request.ServerVariables("SCRIPT_NAME"),"admin/admin_fso.asp","")&s_File
strUrl = Do_Url
dim objXmlHttp
'set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
set objXmlHttp = Server.CreateObject("MSXML2.XMLHTTP")
objXmlHttp.open "GET",strUrl,false
objXmlHttp.send()
Dim binFileData
binFileData = objXmlHttp.responseBody
Dim objAdoStream
set objAdoStream = Server.CreateObject("ADODB.Stream")
objAdoStream.Type = 1
objAdoStream.Open()
objAdoStream.Write(binFileData)
objAdoStream.SaveToFile FilePath,2
objAdoStream.Close()
Response.Write ( "<script>parent.msg.innerHTML='文件已成功生成!';</script>" )