I am using a Web Browser control to allow user to login to the server from a desktop(Windows form) app. after successful response, the server sends the response as XML that contains Security token but i can't read this xml from the WebBrowser control. the browser control converts the XML to strange HTML that i can't processed. Here is my Code:-
var webBrowser = new WebBrowser
{
Dock = DockStyle.Fill
};
webBrowser.DocumentCompleted += webBrowser_DocumentCompleted;
webBrowser.Navigate(url);
void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
var browser = sender as WebBrowser;
if (browser != null)
{
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(browser.DocumentText);
var appNode = doc.DocumentNode.SelectNodes("//myTag");
}
}
and this is my XML that i received from the server
<MyCustomXml>
<securityToken>RETERET-SDSDSD-DSFSDFS-SDASDAS-ASDASDASDASD</securityToken>
<organizationUrl>http://myOrganization.Com/</organizationUrl>
</MyCustomXml>