zoukankan      html  css  js  c++  java
  • 将aspx页面转换成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>"
    %>

  • 相关阅读:
    课程总结
    课程总结
    十四周实验报告&&课程总结
    记事本代码
    第十三周课程总结
    第十二周课程报告
    PTA实验 链表拼接 (20point(s))
    课程总结
    第十四周课程总结&实验报告
    第十三周课程总结
  • 原文地址:https://www.cnblogs.com/tiasys/p/444285.html
Copyright © 2011-2022 走看看