The homepage is automatically generated by template.

Source: Internet
Author: User

The homepage is automatically generated by template.

I am afraid I have forgotten it.

<%
Response. expires = 0
Response. expiresabsolute = now ()-1
Response. addheader "Pragma", "No-Cache"
Response. addheader "cache-control", "private"
Response. cachecontrol = "no-Cache"
Response. Buffer = true
Response. Clear
Server. scripttimeout = 999999999
On Error resume next
'*************************************** ************************
'* Defines the function for reading the homepage from a template
'* Description: The template file name is index_template.asp.
'*************************************** ************************
Function getpage (URL)
Set retrieval = Createobject ("Microsoft. XMLHTTP ")
With Retrieval
. Open "get", URL, false ,"",""
. Send
Getpage = bytestobstr (. responsebody)
End
Set retrieval = nothing
End Function

Function bytestobstr (Body)
Dim objstream
Set objstream = server. Createobject ("ADODB. Stream ")
Objstream. type = 1
Objstream. mode = 3
Objstream. Open
Objstream. Write body
Objstream. Position = 0
Objstream. type = 2
Objstream. charset = "gb2312"
Bytestobstr = objstream. readtext
Objstream. Close
Set objstream = nothing
End Function

'*************************************** ************************
'* Homepage, file name: default.htm
'*************************************** ************************
Dim tstr
Tstr = getpage ("http://www.adhome.net/index_Template.asp ")
Set FSO = server. Createobject ("scripting. FileSystemObject ")
Set fout = FSO. createtextfile (server. mappath (".") & "/default.htm ")
Fout. Write tstr
Fout. Close
Response. Write "<SCRIPT> alert (" "The homepage is generated successfully! /N file name: default.htm ""); location. href = "http://www.adhome.net"; </SCRIPT>"
Response. End
%>

 

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.