ASP generates static HTML page code based on judgment

Source: Internet
Author: User
Tags curl html page

<%
Dim Childtype,curl,childname,childurl,localpath
Childtype = Request. QueryString ("Childtype")
Select Case Childtype
Case "0"
Curl= "Http://www.111cn.net/default.asp"
ChildName = "Site Home"
Childurl = "/index.html"
LocalPath = ""
Case "1"
Curl= "Http://www.111cn.ne t/news/index.asp"
ChildName = "News Center Home"
Childurl = "/news/index.html"
LocalPath = "/news"
Case "2"
Curl= "Http://www.111cn.net/newhouse/index.asp"
ChildName = "New House net Home"
Childurl = "/newhouse/index.html"
LocalPath = "/newhouse"
Case "3"
Curl= "Http://www.111cn.net/home/index.asp"
ChildName = "Home Net"
Childurl = "/home/index.html"
LocalPath = "/home"
Case "4"
Curl= "Http://www.111cn.net/hirehouses/index.asp"
ChildName = "Rental Net Home"
Childurl = "/oldhouse/index.html"
LocalPath = "/oldhouse"
Case Else
End Select


Function Fsochange (Filename,target)
Dim Objfso,objcountfile,filetempdata,htmlout
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath (filename), 1,true)
Filetempdata = Objcountfile.readall
Objcountfile.close
Set htmlout = objFSO.CreateTextFile (server. MapPath (Target))
Htmlout.writeline Filetempdata
Htmlout.close
Set objFSO = Nothing
End Function

Dim Fn,dourl,objxmlhttp,binfiledata,objadostream,filepath
filepath = localpath & "/index_.html"
fn = Server. MapPath (filepath)
Dourl = Curl
' Dourl = Request ("Url")
Set objxmlhttp = Server.CreateObject ("Msxml2.serverxmlhttp")
Objxmlhttp.open "Get", Dourl,false
Objxmlhttp.send ()
Binfiledata = Objxmlhttp.responsebody
Set objadostream = Server.CreateObject ("ADODB. Stream ")
Objadostream.type = 1
Objadostream.open ()
Objadostream.write (Binfiledata)
Objadostream.savetofile fn,2
Objadostream.close ()
Set Objadostream = Nothing
Set objxmlhttp = Nothing
Call Fsochange (LocalPath & "/index_.html", LocalPath & "/index.html")
' Functions to read the contents of a file using the FSO
Function fsofileread (filename)
Dim Objfso,objcountfile,filetempdata
Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Set objcountfile = objFSO.OpenTextFile (Server.MapPath (filename), 1,true)
Fsofileread = Objcountfile.readall
Objcountfile.close
Set objcountfile=nothing
Set objFSO = Nothing
End Function
Call Lib.tiptext (0, "static page <a href=" "" & Childurl & "" target= "" _blank "" ><b> "& ChildName &" &L T;/b></a> Generation Completed "& Now () &" ")
Response. Redirect (Request. ServerVariables ("Http_referer"))
%>

Related Article

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.