I have a bit of code that basically reads an XML document using the XMLDocument.Load(uri) method which works fine, but doesn't work so well if the call is made through a proxy.
I was wondering if anyone knew of a way to make this call (or achieve the same effect) through a proxy?
This is the code that I ended up using:
Use lomaxx's answer but change
to
You can't configure XMLDocument to use proxy. You can use WebRequest or WebClient class to load data via proxy and pass obtained response stream to XMLDocument
Also you can try to use XmlTextReader class. It allows you set network credentials. For details see:
Supplying Authentication Credentials to XmlResolver when Reading from a File
Do you have to provide credentials to the proxy?
If so, this should help: "Supplying Authentication Credentials to XmlResolver when Reading from a File" http://msdn.microsoft.com/en-us/library/aa720674.aspx
Basically, you...
You need to use WebProxy and WebRequest to download the xml, then parse it.