开发者

XmlDocument opening from URL

I am using XmlDocument to open a remote XML document

strin开发者_开发问答g apiURL = Settings.Settings.URLBaseAPI + "user.php";

apiURL = apiURL + "?u=" + Settings.Settings.ForumUsername
       + "&p=" + MD5Tool.GetMD5Hash(Settings.Settings.ForumPassword)
       + "&mode=token";

doc.Load(apiURL);

Is there anyway to set the user agent for the internet access performed to retrieve the XML document?


When loading through the doc.Load(string) method, this is not possible.

You can try and retrieve the xml with WebClient, which will allow overriding some HTTP headers then use doc.LoadXML(string) to populate your XmlDocument.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜