如何使用ASP设置HTTP超时? [英] how to set http timeout using asp?
本文介绍了如何使用ASP设置HTTP超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的ASP code
This is my asp code
<%
http = server.createobject("microsoft.xmlhttp")
http.open "post", servleturl, false
http.setrequestheader "content-type", "application/x-www-form-urlencoded"
http.setrequestheader "accept-encoding", "gzip, deflate"
http.send "request=" & sxml
http_response = http.responsetext
%>
我需要超时时的反应没有在15秒内走过了多少?
i need to make TimeOut when the response not come in 15 seconds how?
推荐答案
使用的的waitForResponse的方法 ServerXMLHTTP的
实例后,。发送
通话是一种合适的方式,我建议。
还使用 .WaitForResponse
,需要通过设置真
的第三个参数。开
方法。
Using waitForResponse method of ServerXMLHTTP
instance after the .Send
call is a proper way, I'd recommend.
Also to use .WaitForResponse
, need to make an asynchronous call by setting True
the third parameter of .Open
method.
Const WAIT_TIMEOUT = 15
Dim http
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP")
http.open "POST", servleturl, True 'async request
http.setrequestheader "content-type", "application/x-www-form-urlencoded"
http.setrequestheader "accept-encoding", "gzip, deflate"
http.send "request=" & sxml
If http.waitForResponse(WAIT_TIMEOUT) Then 'response ready
http_response = http.responseText
Else 'wait timeout exceeded
'Handling timeout etc
'http_response = "TIMEOUT"
End If
Set http = Nothing
这篇关于如何使用ASP设置HTTP超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文