为什么有时执行有时不执行呢
为什么执行有时行有时不行。。。Function GetBody(URL)
on error resume next
Set Retrieval = Server.CreateObject("MSXML2.XMLHTTP")
'Set Retrieval = Server.CreateObject("MSXML2.ServerXMLHTTP")
'Set Retrieval = Server.CreateObject("MsXml2.XmlHttp5.0") 'MsXml2.XmlHttp5.0
With Retrieval
.Open "Get",URL,False,"",""
.setTimeouts 10000,10000,10000,30000
.SetRequestHeader "Referer","AL_HTML" '将HTTP头中来源页变为AL_HTML
.Send
if .readystate<>4 then
Response.Write("链接 config1.asp --- getbody 失败!")
' Response.End()
end if
GetBody = .ResponseBody '获得未经解码的二进制数据
End With
'response.write 1111111111
'response.end
GetBody = BytesToBstr222(GetBody,"GB2312") '调用解码函数
'response.write GetBody
'response.end
Set Retrieval = Nothing
End Function
Function BytesToBstr222(Body,Cset)
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
BytesToBstr222 = Objstream.ReadText
Objstream.Close
set Objstream = nothing
End Function
’不执行时,我重新启动IIS,后,发现该代码又可以执行了。怪事,这个是因为什么呢。