欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

从一个网站扒下的asp生成静态页面的代码 脚本之家特供版

程序员文章站 2022-06-21 22:39:52
复制代码 代码如下:<% webfolder="/" host="index_cn.asp"'前台动态地址 folder="/"'文件夹 filename="inde...
复制代码 代码如下:

<%
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
%>