Domanda

I have classic asp project developed which is returning XML. Now I need to post that XML to ASP.NET WebAPI.

Below is the code for Classic ASP:

Dim testString 
Dim xmlHTTP
Dim postUrl
Dim responseXML
Dim responseText
testString = "This is a test string"
postUrl = "http://localhost:55823/api/order/"
responseText = ""

Set xmlHTTP = server.Createobject("MSXML2.XMLHTTP")
xmlHTTP.Open "POST", postUrl, false
xmlHTTP.setRequestHeader "Content-Type","application/x-www-form-urlencoded"

On Error Resume Next

xmlHTTP.send testString
response.Write testString

Below is how I am calling in WebAPI :

[HttpPost]
public HttpResponseMessage Post([FromBody]string testString)
{

}

But here testString is always returning Null. I even tried public string Post().

Can someone help me in this!!

È stato utile?

Soluzione

As you guys said, I used

 testString = "=This is a test string"

and it is working fine. Since no one posted this as answer, I only posting thinking could help others.

But credit should goes to Lankymart and others.:)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top