I need to load an XmlDocument from a URL. This has been working but it appears I may need to specify a user agent string.
Since XmlDocument doesn’t support this directly, I’m trying to do this via HttpWebRequest:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.UserAgent = "My User Agent";
xml.Load(request.GetRequestStream());
However, the call to xml.Load() above raises a “Cannot send a content-body with this verb-type.” exception.
Can someone who understands this better than I help me out?
GetRequestStream() is for request-data.
Check out GetResponse( ) instead.