把动态页面转换为静态页面,采用下面的代码:
<%
Call CreateHtml("http://192.168.1.7/index.asp","index.htm","/")
Function CreateHtml(Url, Filename, Path)
Set MyFileObject = Server.CreateObject("Scripting.FileSystemObject")
Path1 = Server.Mappath(Path) & "\" & FileName
Set MyTextFile = MyFileObject.CreateTextFile(Path1)
MyTextFile.WriteLine(GetHTTPPage(Trim(Url)))
MytextFile.Close
Response.Write "生成" & FileName&"成功<br>"
Set MyFileObject = Nothing
End function
Function GetHTTPPage(Url)
On Error Resume Next
Dim Http
Set Http = Server.createobject("Microsoft.XMLHTTP")
Http.open "GET", url, False
Http.send()
If Http.Readystate <> 4 Then Exit Function
GetHTTPPage = BytesToBSTR(Http.ResponseBody,"GB2312")
Set Http = Nothing
If Err.number <> 0 Then
Response.Write "<p align='center'><font color='red'><b>服务器获取文件内容出错</b></font></p>"
Err.Clear
End If