![]() |
#2
madpbpl2008-03-06 16:50
楼主做个参考
保存为*.asp 放在和index.asp同一目录,运行,就可以生成静态的index.htm <% function getHTTPPage(url) dim Http set Http=server.createobject("Microsoft.XMLHTTP") Http.open "GET",url,false Http.send() if Http.readystate<>4 then exit function end if getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312") set http=nothing if err.number<>0 then err.Clear end function Function BytesToBstr(body,Cset) dim objstream set objstream = Server.CreateObject("adodb.stream") objstream.Type = 1 objstream.Mode =3 objstream.Open objstream.Write body objstream.Position = 0 objstream.Type = 2 objstream.Charset = Cset BytesToBstr = objstream.ReadText objstream.Close set objstream = nothing End Function Dim Url,Html Url="http://" & request.ServerVariables("HTTP_HOST") & "/index.asp '要生成的页面" msg = getHTTPPage(Url) filez=server.mappath(".")&"/index.htm" '生成的静态文件名 set fs=server.createobject("Scripting.FileSystemObject") set ts = fs.createtextfile(filez,true) '写文件 for z=1 to len(msg) write_now=mid(msg,z,1) ts.write(write_now) next ' ts.writeline(all_msg) ts.close set ts=nothing '文件生成 %> |
我现在做了一个asp网站 想把它生成静态
应该如何做?
请 大家帮帮我 !