Generate a Static Page code script from asp under a website

Source: Internet
Author: User

Copy codeThe Code is as follows: <%
Webfolder = "/"
Host = "index_cn.asp" 'foreground Dynamic Address
Folder = "/" 'folder
Filename = "index_cn.html" 'to generate a static file name
Fso_info host, folder, filename
Response. write "static HTML of the Chinese homepage of the website is generated. <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 & "generate <font color = '# FF0000'> failed </font>. Your file name may contain special characters. <br/>"
End if
End Function
'Generate the file
Function SaveFile (LocalFileName, RemoteFileUrl)
Dim Ads, Retrieval, GetRemoteData
On Error Resume Next
Set Retrieval = Server. CreateObject ("Microso" & "ft. XM" & "LHTTP") '// open the word to prevent false positives
With Retrieval
. Open "Get", RemoteFileUrl, False ,"",""
. Send
GetRemoteData =. ResponseBody
End
Set Retrieval = Nothing
Set Ads = Server. CreateObject ("Ado" & "db. Str" & "eam") '// separate the words to prevent false positives
With Ads
. Type = 1
. Open
. Write GetRemoteData
. SaveToFile Server. MapPath (LocalFileName), 2
. Cancel ()
. Close ()
End
Set Ads = nothing
If err <> 0 then
SaveFile = false
Err. clear
Else
SaveFile = true
End if
End function
%>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.