如何将asp动态转化为静态
发布:浩喆 | 发布时间: 2008年9月20日网站建设的初期就应该把优化考虑在内,那么在动态网页中至关重要的就是把动态转化为静态,现在我说一说把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
%>
- 相关文章:
人际关系 (2008-9-16 20:38:56)
珍惜时间 (2008-9-15 18:54:33)
SEO在于交流 (2008-9-12 22:43:23)
网上和网下的营销结合 (2008-9-9 21:52:54)
当SEO遇到SEO的时候 (2008-9-7 22:24:26)
一起挥汗如雨 (2008-9-6 16:15:36)
SEO遇到的尴尬 (2008-9-4 20:39:52)
SEO在为自己做竞价推广 (2008-8-31 22:54:20)
发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。





