当前位置: 首页 > 图文教程 > 网络编程 > ASP > 将指定的asp文件内容生成HTML文件

ASP
asp+语法教程(三)asp+的服务器端编程初步
asp+语法教程(四)asp+的服务器端编程进介
asp+语法教程(五)asp+的服务器端编程控件篇
asp+语法教程(六)数据库篇
从ASP迁移至ASP+
从ASP迁移至ASP+ --进入DataSet
从ASP迁移至ASP+ --HTML表格转换为ASP+列表
从ASP迁移至ASP+ --转换其他的页面
从ASP迁移至ASP+ --处理会话变量
ASP十步进阶
asp.net高级教程(一)-asp.net还是asp+ ?
asp.net高级教程(二)- 转换编程思维
asp.net高级教程(三)-对象
asp.net高级教程(三)-实战篇
asp.net高级教程(五)-实战篇(中)
ASP+中文教程(一)--asp+简介、安装、以及如何显示中文
asp+中文教程(二)-- Asp+ Web Forms
APS + 中文教程(三)--服务器端控制(一)
SQL数据操作基础(初级) 4
SQL数据操作基础(初级) 5

ASP 中的 将指定的asp文件内容生成HTML文件


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 42 ::
收藏到网摘: n/a

 

<%
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.taiang.com.cn/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>"
%>