文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学的各位小编整理了ASP-从一个网站扒下的asp生成静态页面的代码 脚本之家特供版的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
复制代码 代码如下:
<%
webfolder="/"
host="index_cn.asp"''前台动态地址
folder="/"''文件夹
filename="index_cn.html"''生成静态文件名
Fso_info host,folder,filename
response.write"生成网站中文首页静态HTML完成.<br />"
''生成html
Function Fso_info(host,folder,filename)
host="http://"+Request.ServerVariables("HTTP_HOST")&webfolder&host
if SaveFile(""&folder&filename&"",""&host&"") then
response.Write ""&folder&filename&" 生成成功. <br />"
else
Response.write ""&folder&filename&" 生成<font color=''#FF0000''>失败</font>,可能您的文件名含有特殊字符.<br />"
end if
End Function
''生成文件
function SaveFile(LocalFileName,RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server.CreateObject("Microso" & "ft.XM" & "LHTTP") ''//把单词拆开防止杀毒软件误杀
With Retrieval
.Open "Get", RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Ado" & "db.Str" & "eam") ''//把单词拆开防止杀毒软件误杀
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads=nothing
if err <> 0 then
SaveFile = false
err.clear
else
SaveFile = true
end if
End function
%>