首页 分类 排行 更新 资源发布 广告联系 下载帮助 意见反馈 本站声明
加入收藏夹
教育教学 电脑世界 行业范文 生活天地 数码天地 科技世界 工具软件 精品源码 素材中心 文章中心 网友留言 网站论坛

您的位置:首页-> 文章中心-> 电脑世界-> 网页设计-> 将指定的ASP文件生成静态页面
将指定的ASP文件生成静态页面
发布商链接

作者:佚名 来源:化学教育资源网 加入时间:2006-7-5 人气:105

<%
    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="lxxx.com/index.asp" target="_blank">http://www.xxx.com/index.asp"
    response.write "开始更新首页..."
    wstr = GetPage(Url)
    
    Set fs=Server.CreateObject("Scripting.FileSystemObject")
    
    'if not MyFile.FolderExists(server.MapPath("/html/")) then
    'MyFile.CreateFolder(server.MapPath("/html/"))'
    'end if
    
    If (fs.FileExists(server.MapPath("./")&"\index.htm")) Then
    fs.DeleteFile(server.MapPath("./")&"\index.htm")
    End If
    
    Set CrFi=fs.CreateTextFile(server.MapPath("./")&"\index.htm")
    Crfi.Writeline(wstr)
    set CrFi=nothing
    set fs=nothing
    response.write "...<font color=red>更新完成!</font>"
    %> 

相关文章

相关软件