ASP application tips: A way to generate static Web pages
Source: Internet
Author: User
Tips | static | Web Page The following code can help you generate static pages, such as: List.asp is read the database page, to be born in the list.htm static page, your domain name is xxx.com, you can use the following code, using the method:
If SaveFile ("/htm/list.htm", "http://www.xxx.com/asp/list.asp") Then
Response.Write "Generated"
Else
Response.Write "No Build"
End If
If the build fails, please block the code on error Resume next to see the specific error message
The code is as follows:
<%
If SaveFile ("/htm/list.htm", "http://www.xxx.com/asp/list.asp") Then
Response.Write "Generated"
Else
Response.Write "No Build"
End If
function SaveFile (Localfilename,remotefileurl)
Dim Ads, retrieval, Getremotedata
On Error Resume Next
Set retrieval = Server.CreateObject ("Microso" & ft.) XM "&" Lhttp ")
With retrieval
. Open "Get", Remotefileurl, False, "", ""
. Send
Getremotedata =. Responsebody
End With
Set retrieval = Nothing
Set Ads = Server.CreateObject ("Ado" & "db.") Str "&" Eam ")
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
%>
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