tags:

views:

85

answers:

1

I am getting this error:

Data at the root level is invalid. Line 1, position 1.

Here's my code:

XmlDocument doc = new XmlDocument();

foreach (string c in colorList)
{
    doc.LoadXml("http://whoisxmlapi.com/whoisserver/WhoisService?domainName=" +
        c + "&username=user&password=pass");
    textBox1.Text += doc.SelectSingleNode(
        "/WhoisRecord/registrant/email").InnerText + ",";
}

Anyone know why I'm getting this exception?

I've tried to run the URL in the browser without any problems

+11  A: 

use doc.Load("http:...")
LoadXml is for XML strings, not URLs

Marvin Smit