自動按模板產生網站首頁.

來源:互聯網
上載者:User

自動按模板產生網站首頁.

主要是備份一下.我怕我自己都忘記了.

<%
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
'***************************************************************
'*                        定義 從模板從讀取首頁 函數
'* 說明:模板檔案名稱為:index_Template.asp
'***************************************************************
Function GetPage(url)
        Set Retrieval = CreateObject("Microsoft.XMLHTTP")
        With Retrieval
        .Open "Get", url, False, "", ""
        .Send
        GetPage = BytesToBstr(.ResponseBody)
        End With
        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

'***************************************************************
'* 生頁首頁,檔案名稱為: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(""產生首頁成功!/n/n檔案名稱為:default.htm"");location.href="http://www.adhome.net";</script>"
   Response.end
%>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.