Question

In my previous question, I was accidentally sending token/value pairs with an text/xml Content-Type which resulted in nothing being sent. Tim C's insight into that problem was extremely helpful. Thanks again, Tim!

Looking back at the original sending code, I now realize that the setting of the ServerXMLHTTP's Content-Type to text/xml was a recent and erroneous addition. The sending code I posted in my question looked like this:

url = "www.receivingwebsite.com\asp\receivingwebpage.asp"
information = "UserName=Colt&PassWord=Taylor&Data=100"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.setRequestHeader "Content-Type", "text/xml"
xmlhttp.send information

The actual sending code is really:

url = "www.receivingwebsite.com\asp\receivingwebpage.asp"
information = "UserName=Colt&PassWord=Taylor&Data=100"
Set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST", url, false
xmlhttp.send information

...with no attempt to set the Content-Type before sending.

Unfortunately, the problem that originally lead me to ask for help still exists. My receiving classic asp page cannot see the information which is being posted by the ServerXMLHTTP object. The information is not in the request object's querystring or the form array. No matter what I do, I can't find the information but I know that it is being sent because when I change the content-type to application/x-www-form-urlencoded, I can see it in request.form array.

So what is the default content-type of the MSXML2.ServerXMLHTTP class? And where is my information when the sending class is using that default content-type?

Thanks in advance for any assistance! Peace, Colt Taylor

Was it helpful?

Solution

ASP will only fill the form array if the content type of the POST is "application/x-www-form-urlencoded". Generally ServerXMLHTTP will not set the content type header so if you don't do it manually no content type header is sent.

An exception to this is where you pass an XML Document as the parameter to send, in that case ServerXMLHTTP will set content type to "text/xml; charset=UTF-8".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top