Share via


How to use XMLHttpRequest() in C#

Question

Friday, August 21, 2009 12:02 AM

Hi there, I am creating an application that uses XML Web services. Can you tell me about similar class like XMLHttpRequest() of javascript that has a C# equivalent. Any help would be very much appreciated.


Best Regards Gopal Adhikari
Visit My Blog at: http://hacktheugly.wordpress.com

All replies (3)

Wednesday, August 26, 2009 3:28 PM ✅Answered

XMLHttpRequest is a javascript object, not a C# object.  You can't use it from C#.  To do similar things, use HttpWebRequest to request the XML document you need, and use an XmlDocument class to get access to the document after you retrieve your response. 

Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light WikiTwitterLinkedInForumsBrowser


Saturday, January 22, 2011 12:45 AM

 

XMLHTTPClass lobjRequest = new XMLHTTPClass

();

 

string lstrNull = null;

object

 

lobjNull =lstrNull;

string

 

lstrBody=""

;

lobjRequest.open(

"POST", "http://XXXX.com.mx", false

, lobjNull, lobjNull);

lobjRequest.setRequestHeader(

"Content-Type","application/x-www-form-urlencoded"

);

lobjRequest.setRequestHeader(

"Referer", "http://XXXXXX.com.mx");

string

 

lstrRequest="xxxxxxxxxxxxxxxxx"

;

lobjRequest.send(lstrRequest);

lstrBody = lobjRequest.responseText ;

 Recuerda agregar como referencia COM Microsoft.xml.v3 o v2 y Microsoft.xml.2.0

 


Sunday, March 27, 2011 10:39 AM

But we want use it in web dev with c#, how we can use it?