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

ASP
Server Application Error错误解决思路
ASP教程:在IIS环境下自己设置404页面
ASP代码出现80040e14错误的解决方法
Http_Referer,Server_Name和Http_Host
HTTP_X_FORWARDED_FOR和REMOTE_ADDR
总结的Server.Mappath的用法
巧用ASP脚本命令重启服务器
实现数字字符串的最大值、最小值和平均值
详解ASP脚本的执行顺序
理解认识阿里妈妈淘客系统对外接口通用规范
网站开发者参考:开源ASP网站源码
IIS管理程序Adsutil.vbs修改FTP服务器的PASV端口范围
ASP程序中调用函数Now()异常的问题
流量大的网站不要选择万能空间
网站挂马方式大总结
启动 W3SVC 服务报错怎么解决
Vista系统安装IIS7配置ASP运行环境
Server Application Error 8004EOOF错误
ASP不用模板直接简单生成HTML页面
ASP教程:gb2312和utf-8乱码问题解决

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


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