标题:ASP如何生成HTML
取消只看楼主
xoyeo
Rank: 1
等 级:新手上路
帖 子:31
专家分:0
注 册:2006-5-24
 问题点数:0 回复次数:0 
ASP如何生成HTML

<%

function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
Function BytesToBstr(body,Cset)
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 = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing

End Function

txtURL=server.MapPath("../checkjs.asp")
sText = getHTTPPage(txtURL)
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
filename="../index.htm"
Set openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true) 'true为不存在自行建立
openFile.writeline(sText)
Set OpenFile=nothing
%>
<script>
alert("静态网页生成完毕");
history.back();
</script>
这个代码是在网上找到的,我用了不成功,到Set openFile=FileObject.OpenTextfile(server.mapPath(filename),2,true)就出错了,不知道为什么不能成功,请高手帮忙看看

搜索更多相关主题的帖子: ASP HTML 
2007-06-27 16:47



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-150782-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.849075 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved