利用Asp生成整站静态
很多人在网说要全站转静态程序但是大多数都没结果的,所以小妹妹凭着一知半解的写了这个代码希望有了解 asp转静态技术 交流一下
QUOTE:
<%
On Error Resume Next
Server.ScriptTimeOut=9999999
Function getHTTPPage(Path)
t = GetBody(Path)
getHTTPPage=BytesToBstr(t,"GB2312")
End function
Function GetBody(url)
on error resume next
Set Retrieval = CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", url, False, "", ""
.Send
GetBody = .ResponseBody
End With
Set Retrieval = Nothing
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
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
%>
xmlhttp.asp
QUOTE:
<!--#include file="xmlhttp.asp"-->
<%
url="co.asp?id=2,"
wb_cx=PcMane(url)
IF wb_cx<>"" THEN
RESPONSE.Write("开始转换静态过程")
fso_wstr=split(wb_cx,",")
for i=0 to UBound(fso_wstr)-1
qman_html_min=(thhs(thhs(fso_wstr(i),"?","~"),".asp","")&".html")
qman_html_min=getHTTPPage(http&fso_wstr(i))
for j=0 to UBound(fso_wstr)-1
qman_html_min=thhs(qman_html_min,fso_wstr(j),thhs(thhs(fso_wstr(j),"?","~"),".asp","")&".html")
qman_html_min=thhs(qman_html_min,".html&",".html?")
next
Set fso = Server.CreateObject("Scripting.FileSystemObject")
FilePath = Server.MapPath(qman_html_url)
Set fout = fso.CreateTextFile(FilePath)