<noframes id="3fdf1">

      <pre id="3fdf1"></pre>
        <ruby id="3fdf1"></ruby>
        <track id="3fdf1"><strike id="3fdf1"><rp id="3fdf1"></rp></strike></track>
        <pre id="3fdf1"></pre>
        <pre id="3fdf1"><ruby id="3fdf1"></ruby></pre>

        <ruby id="3fdf1"><strike id="3fdf1"><var id="3fdf1"></var></strike></ruby>

        建站知識

        Welcome to Beijing RuiHeng TianLong Technology Co., Ltd.

        網站建設中asp轉成html靜態頁方法,演示,需要注意什么?

        時間:  來源:網站建設公司  作者:網站制作公司  點擊量:
        網站建設中asp轉成html靜態頁方法,演示,需要注意什么?
        asp網站建設的弊端是不能做太大型網站,我們指的是asp+access的形式,另外,asp網站有時候運行起來會很慢,我們需要從源頭找方法解決,前段時間有個asp頁面執行起來很慢,訪問人數又頗多,而且又不經常修改,又懶得直接做成靜態的,每次都要從服務器下載來改,只好想辦法把asp頁面轉化成htm靜態頁面了,以增加承載的訪問人數和較少資源的消耗。此代碼適合萬網提供的獨立主機。  
          <% 
          Function GetPage(url) 
           '獲得文件內容 
           dim Retrieval 
           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 
           
          on error resume next 
          Url="http://www.sina.com.cn" 要讀取的頁面地址 
          response.write "開始更新首頁..." 
          wstr = GetPage(Url) 
           
          'response.write(wstr) 
          Set fs=Server.CreateObject("Scripting.FileSystemObject") 
           
          'if not MyFile.FolderExists(server.MapPath("/html/")) then 
          'MyFile.CreateFolder(server.MapPath("/html/"))' 
          'end if 
           
          '要存放的頁面地址 
          dizhi=server.MapPath("index.htm") 
          If (fs.FileExists(dizhi)) Then 
          fs.DeleteFile(dizhi) 
          End If 
           
          Set CrFi=fs.CreateTextFile(dizhi) 
          Crfi.Writeline(wstr) 
          set CrFi=nothing 
          set fs=nothing 
          response.write "...<font color=red>更新完成!</font>" 
          %>      
          代碼算是最簡單的,直接保存成一個asp文件即可,只要把URL(要轉化的asp地址)和地址(要保存的html地址)設置好就可以了,一般這兩個文件在同一個目錄,才能保證圖片或者css、js起作用。
        本文TAG標簽: asp網站制作 asp網站建設
        返回關閉本頁
        上一篇:網站制作中css樣式em不管用,strong失效問題,初始化不管用。    下一篇:asp網站制作中for循環語句怎么應用,for循環實例。
        推薦閱讀

        Copyright © 2010-2021 北京瑞恒天龍科技有限公司  All Rights Reserved  |  北京網站建設知名服務商  |  北京網站制作 | 京ICP備11004170號-1   京公網安備110107000463號
        地址:北京市海淀區永定路長銀大廈B座  非工作時間:15810379666  服務熱線:010-89941606 座機:010-89941606 轉801/802/803/804  版權所有 盜版必究!

        在線咨詢
        關閉
        電話咨詢
        網站制作電話
        010-89941606