生成静态首页出错。。求大神指导。。。
错误类型:Server 对象, ASP 0177 (0x8007007E)
8007007e
/admin_ht/scsy.asp, 第 39 行
39行代码:Set Fileobject=Server.CreateObject("scripting.filesystemobject")
scsy.asp全部代码如下:
<%
'常用函数
'1、输入url目标网页地址,返回值getHTTPPage是目标网页的html代码
function getHTTPPage(url)
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
'2、转换乱码,直接用xmlhttp调用有中文字符的网页得到的将是乱码,可以通过
'adodb.stream组件进行转换
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="http://localhost/index_s.asp"
sText = getHTTPPAGE(txtURL)
Set Fileobject=Server.CreateObject("scripting.filesystemobject")
filename="index.asp"
set openfile=fileobject.opentextfile(server.MapPath("../"&filename),2,true)'true为不存在自行建立
openfile.writeline(sText)
set openfile=nothing
%>
<script>
alert("操作成功")
window.location.href="main.asp"
</script>