Posting data to Http and receiving data in XML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to create a web client code in C# that retrieves data from a web site in sync method.
I have the following code in VB script that works today but need to be converted to c#
Set xmlHttp = WScript.CreateObject("Microsoft.XMLHTTP"
Set xmlDom = WScript.CreateObject("Microsoft.XMLDOM"
xmlDom.LoadXml("<PDETAILS FirstName=""John"" LastName=""James"" "" ZipCode=""78012"" />"
xmlHttp.Open "POST", "http://host/Purschase.aspx"; 0
xmlHttp.Send(xmlDom
xmlDom.LoadXml(XmlHttp.responseXml.Xml

Response from the site is in Xml format
A pointer & sample to C# classes will be appreciated
 
Mike,

I believe that this was answered already in a previous post. Basically,
you will want to use the HttpWebRequest and HttpWebResponse classes to send
a request and get the response. Once you have that, you can use the
XmlDocument class in the System.Xml namespace to parse the XML returned and
use it.

If you really want, you can use COM interop to do this, and use the same
method calls (in C# of course). However, I think that it would be better to
use the managed classes.

Hope this helps.
 
Back
Top