EDN Admin
Well-known member
Hello Everybody,
Im using this code to get XmlDocument from url: using (WebClient wc = new WebClient())
{
wc.Credentials = new NetworkCredential("admin", "admin");
string xml = wc.DownloadString("http://192.168.1.187:8550/epe/pos/taglist");
XmlDocument tournamentsXML = new XmlDocument();
tournamentsXML.LoadXml(xml);
XmlNodeList TagList = tournamentsXML.GetElementsByTagName("TAG");
foreach (XmlNode node in TagList)
{
XmlElement TagElement = (XmlElement)node;
string TagID = TagElement.GetElementsByTagName("tagid")[0].InnerText;
string MAC = TagElement.GetElementsByTagName("mac")[0].InnerText;
Data.Add(new Tag(TagID,MAC));
}
}
Its work fine,
But when I change the link to "http://192.168.1.187:8550/epe/pos/taglist?fields=posgood"
it give me error message "The remote server returned an error: (401) Unauthorized."
By the way when I copy past the same link "http://192.168.1.187:8550/epe/pos/taglist?fields=posgood" to browser it retreive XML data exactly !!
Please help me please
Belal
View the full article
Im using this code to get XmlDocument from url: using (WebClient wc = new WebClient())
{
wc.Credentials = new NetworkCredential("admin", "admin");
string xml = wc.DownloadString("http://192.168.1.187:8550/epe/pos/taglist");
XmlDocument tournamentsXML = new XmlDocument();
tournamentsXML.LoadXml(xml);
XmlNodeList TagList = tournamentsXML.GetElementsByTagName("TAG");
foreach (XmlNode node in TagList)
{
XmlElement TagElement = (XmlElement)node;
string TagID = TagElement.GetElementsByTagName("tagid")[0].InnerText;
string MAC = TagElement.GetElementsByTagName("mac")[0].InnerText;
Data.Add(new Tag(TagID,MAC));
}
}
Its work fine,
But when I change the link to "http://192.168.1.187:8550/epe/pos/taglist?fields=posgood"
it give me error message "The remote server returned an error: (401) Unauthorized."
By the way when I copy past the same link "http://192.168.1.187:8550/epe/pos/taglist?fields=posgood" to browser it retreive XML data exactly !!
Please help me please
Belal
View the full article