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

ASP
在ASP程序中实现数据库事务控制
怎样开始一个ASP网站的设计
ASP中使用ServerVariables集合详解
关于解决商务平台ASP程序的源代码泄漏设想与思考
ASP通用模板类
javascript利用xmlhttp获得服务器时钟的方法
asp+oracle分页程序类(XDOWNPAGE2.0)
ASP中实现小偷程序的原理和简单
asp中vbscript访问xml文件
ASP防SQL注入攻击程序
用ASP读INI配置文件的函数
asp实现关键词获取(各搜索引擎,gb2312及utf-8)
xmlhttp组件获取远程文件并筛选出目标数据
XMLHTTP Get HTML页面时的中文乱码之完全客户端Script解决方案
WEB打印设置解决方案一(通过修改注册表改变IE打印设置)
WEB打印设置解决方案二(利用ScriptX.cab控件改变IE打印设置)
WEB打印设置解决方案三(FileSystem组件实现WEB打印)
WEB打印设置解决方案四(在ASP中实现网络打印功能)
ASP实用技巧 强制刷新网页
Access通用-自动替换数据库中的字符串

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


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