Copy the following code into a new Active Server Pages (ASP) page called
ServerHTTP.asp. Place the ASP page in the default Home directory.<%
DataToSend = "id=1"
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
'replace localhost with the server you would like to post to
xmlhttp.Open "POST","http://localhost/Receiver.asp",false
'set header to tell the receiving we are posting form data
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend 'send data in the form of a query string
Response.ContentType = "text/xml" '*note what this does
Response.Write xmlhttp.responsexml.xml 'return response from home database
Set xmlhttp = nothing
%>
NOTE: The two ASP pages should be in different virtual
folders due to threading issues.
If pooling is set to Low or Medium (this is the default for Microsoft Windows
2000), you should POST to an ASP in a different virtual folder. If the ASP is in
the same virtual folder, the ASP stops responding (hangs). After you close the
browser, that ASP and other ASPs continue to hang because the request stays
queued even though you close the browser. You must restart IIS or restart the
computer.
If you change the pooling to High, you can run the code to the remote ASP again
because you are using a new thread.
Copy the following code into a new ASP page called Receiver.asp.
Place the ASP page in the default Home directory.
<%
value = Request.Form("id")
Response.ContentType = "text/xml" '* note what this does
response.write "<ReturnValue>" & value & "</ReturnValue>"
%>
|