Principle: Transfer variables through the browser, such as
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 the number of visits to the Web site, each read from the database is the cost of efficiency, many use Access as a database will be more experience, static page add in search, 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.