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

ASP
ASP技巧:让Len,Left,Right函数识别中文
Flash和ASP实现的用户登录/注册程序
ASP随机显示不重复记录解决方案
ASP动态网页制作常用错误处理
ASP对网页进行限制性的访问
初学:ASP内建对象Response
ASP Server object error的解决办法
ASP教程,ASP实现防盗链的方法
更改windows XP 的IIS连接数
xmldom在服务器端生成静态html页面
asp技巧:防止被杀毒软件误删的代码
ASP教程:初步接触ASP缓存技术
ASP教程:rs.getrows的使用方法介绍
ASP技巧:Utf-8和Gb2312乱码问题的终结
ASP教程:applicaton对象的使用集合
ASP环境:启动停止IIS不重启电脑的技巧
利用FLV组件制作的播放器,动态获取变量,控制FLV文件
ASP教程:ASP错误ASP 0201的解决方法
ASP技巧教程:认识学习codepage的属性
Codepage参数和其对应的语言

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


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