如何用asp把一篇文章以html的格式显示?

来源:百度知道 编辑:UC知道 时间:2024/06/24 16:18:10

前段时间有个asp页面执行起来很慢,访问人数又颇多,而且又不经常修改,又懒得直接做成静态的,每次都要从服务器下载来改,只好想办法把asp页面转化成htm静态页面了。。。

以前就曾经看到这样的文章,不过没太在意,真正想用的时候很难找到一个合适的,于是在网上搜索了半天终于找到比较合适的代码再加上自己的修改,如下:

<%
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