AFAIK with XmlHttpRequest I can download and upload data just with the send method. But WebClient has plenty of methods. I don’t want all the functionality of a WebClient. I just want to create an object that emulates a XmlHttpRequest, except that it doesn’t have XSS restrictions. I also don’t care about getting the response as an XML or even as a string right now. If I can get it as an array of bytes that’s good enough.
I thought that I could use the UploadData as my universal method, but it fails when trying to download data with it even though it returns a response. So how can I write a method that behaves just like XmlHttpRequest‘s send method?
Edit: I found an incomplete class that is precisely an XmlHttpRequest emulator here. Too bad the whole code is lost.
You’ll need to use an HttpWebRequest.