How to send request from XMLHTTP without waiting for the response

asp-classic

pXML= Product_Request
set http= server.Createobject("MSXML2.ServerXMLHTTP")
http.Open "GET", "http://test.com/Data_Check/Request.asp?XML_File=" & pXML , False
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
http.send

I need to send request with above asp code for the above URL. But i no need response from that server.

After sending the request, it waits for the response.
How do I write this so that it doesn't block while waiting for the response?

Best Answer

Change your Open request to Asynchronous (i.e. 3rd parameter to True). This will allow you to submit two requests at the same time. Then you get wait for both responses to arrive.

pXML = Product_Request
Set http = server.Createobject("MSXML2.ServerXMLHTTP")
http.Open "GET", "http://test.com/Data_Check/Request.asp?XML_File=" & pXML , True
http.Send
Set http2 = server.Createobject("MSXML2.ServerXMLHTTP")
http2.Open "GET", insert_code_for_your_second_url_here , True
http2.Send
http1.WaitForResponse
http2.WaitForResponse
Related Topic