网站建设的初期就应该把优化考虑在内,那么在动态网页中至关重要的就是把动态转化为静态,现在我说一说把asp动态如何转化为静态,供大家参考:

<%
'作者:浩喆
'http://www.qdsem.com.cn/
Dim FileName,UrlPath
FileName="/1.html" '要生成的文件路径及地址
UrlPath ="http://www.baidu.com"
Call SaveToFile(FileName,GetTheHTMLCode(UrlPath))
Response.write UrlPath&" ==> "&FileName&" <br>。。快去看看"
'用XMLHTTP得到源码
Function GetTheHTMLCode(Url)
Dim Http
Set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",Url ,false
Http.send()
If Http.readystate<>4 then
Exit Function
End if
GetTheHTMLCode = BytesToBSTR(Http.responseBody,"GB2312")
Set Http=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
'保存文件
Sub SaveToFile(FilePath,FileContent)
Dim Fso ,File
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set File = Fso.createTextFile(Server.Mappath(FilePath))
File.Write (FileContent)
File.Close
Set File=Nothing
Set Fso=Nothing
End Sub
%>