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

ASP
WEB打印设置解决方案四
截取固定长度字符串显示在页面
如何得到上一次插入记录后自动产生的ID
组件:Adodb.Stream 浅释
一个统计当前在线用户的解决方案
实例演练ASP+XML编程
IP地址分段计算
身份证验证代码函数
简单购物车教程
ASP分页函数
asp中对ip进行过滤限制函数
不用Golobal和session实现在线人数统计
ASP实现结构化列举并查看某路径下所有文件
常用Response对象的使用祥解
在ASP网站设计中表单验证
动网论坛代码分析
轻松实现将上传图片到数据库
读取数据库中数据到数组的类
网址和邮件地址的转换函数
ASP编码优化

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 72 ::
收藏到网摘: 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>"
%>