ASP-generated HTML static page method

Source: Internet
Author: User

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 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.

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.