ASP method for generating static web pages

xiaoxiao2021-04-04  267

As the number of website visits increases, each time you read is taken as the price from the database, many of the use of Access is more experienced, and the static page is in searching, it will be prioritized. The popular practice on the Internet is to write data source code to the database and then read from the database to generate a static surface, which invisibly increases the database. Generate a static page directly to the existing ASP page will save a lot.

The following example is, index.asp? Id = 1 / index.asp? Id = 2 / index.asp? Id = 3 / these three dynamic pages, generate ndex1.htm, index2.htm, index3.htm existence The root directory:

CODE:

<% Dim strUrl, Item_Classid, id, FileName, FilePath, Do_Url, Html_TempHtml_Temp = "

    " For i = 1 To 3Html_Temp = Html_Temp & "
  • " Item_Classid = iFileName = "Index" & Item_Classid & ". Htm" FilePath = Server .MapPath ( "/") & "/" & FileNameHtml_Temp = Html_Temp & FilePath & "" Do_Url = "http: //" Do_Url = Do_Url & Request.ServerVariables ( "SERVER_NAME") & "/ main / index.asp" Do_Url = Do_Url & "? Item_Classid =" & Item_ClassidstrUrl = Do_Urldim objXmlHttpset objXmlHttp = Server.CreateObject ( "Microsoft.XMLHTTP") objXmlHttp.open "GET", strUrl, falseobjXmlHttp.send () Dim binFileDatabinFileData = objXmlHttp.responseBodyDim objAdoStreamset objAdoStream = Server.CreateObject ( "ADODB .Stream ") objAdoStream.Type = 1objAdoStream.Open () objAdoStream.Write (binFileData) objAdoStream.SaveToFile FilePath, 2objAdoStream.Close () NextHtml_Temp = Html_Temp &"
      "%> <% Response.Write (" success makefile: ") Response.write ("
      ") response.write html_temp%>

      TRACKBACK: http://tb.blog.9cbs.net/trackback.aspx?postid=458488

转载请注明原文地址:https://www.9cbs.com/read-131973.html

New Post(0)