Although Script House has released relevant codes before, some special websites are not perfect. Recently, I helped customers modify the system and found this code. I found it to be pretty good, so I extracted it for everyone's convenience.
Copy the code code as follows:
<%
webfolder="/"
host="index_cn.asp"'front desk dynamic address
folder="/"'folder
filename="index_cn.html"'Generate static file name
Fso_info host,folder,filename
response.write "Complete generating static HTML for the Chinese homepage of the website.<br />"
'Generate html
Function Fso_info(host,folder,filename)
host="http://"+Request.ServerVariables("HTTP_HOST")&webfolder&host
if SaveFile(""&folder&filename&"",""&host&"") then
response.Write ""&folder&filename&" generated successfully. <br />"
else
Response.write ""&folder&filename&" failed to generate <font color='#FF0000'></font>. Maybe your file name contains special characters.<br />"
end if
End Function
'Generate file
function SaveFile(LocalFileName,RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server.CreateObject("Microso" & "ft.XM" & "LHTTP") '//Split the words to prevent accidental killing by anti-virus software
With Retrieval
.Open "Get", RemoteFileUrl, False, "", ""
.Send
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Ado" & "db.Str" & "eam") '//Split the words to prevent accidental killing by anti-virus software
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile Server.MapPath(LocalFileName), 2
.Cancel()
.Close()
End With
Set Ads=nothing
if err <> 0 then
SaveFile = false
err.clear
else
SaveFile = true
end if
End function
%>