Http://127.0.0.1/shengcheng.asp?id=90
Code:
If SaveFile ("/new/" &id& ". html", "http://127.0.0.1/news.asp?id=" &id& "") Then
/new "&id&". html "is the file and path you generate." Http://127.0.0.1/news.asp?id= "&id&" is the ASP's path
You can set your own changes, where "&id&" is a variable to read the browser. Change the URL to your own.
Use the method to add a connection to your list of articles, such as http://127.0.0.1/shengcheng.asp?id=90
90 This variable I believe you will call it, so you can generate in the/new directory by ID of the HTML article
shengcheng.asp files are as follows:
<%
Dim ID
id = Request("id")
%>
<%
If SaveFile ("/new/" &id& ". html", "Http://127.0.0.1/news.asp? " ID="&id&") 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 ") '//Take apart the word to prevent the killing of antivirus software
With retrieval
. Open "Get", Remotefileurl, False, "", ""
. Send
Getremotedata =. Responsebody
End With
Set Retrieval = Nothing
Set Ads = Server. CreateObject ("Ado" & "db". Str "&" Eam ") '//Take apart the word to prevent the killing of antivirus 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
%>
With the increase in Web site traffic, every time from the database read is the cost of efficiency, many use Access as a database will be more experience, static page add in search, also will be given priority. The popular practice on the internet is to write the data source code into the database and then read from the database to generate static surface, so that the invisible room to enlarge the database. Creating a static page directly from an existing ASP page will save you a lot of money.