read XML from URL and secure it



I have a general quastion and its about security. i have my own webapplication and i want to show data from another website by reading its XML.


But its not secure to parse XML from extern resource, the page my contain harmfull script or somthing. What to do that parsing xml and avoid all scripts that may harm my site.


this is my parsing but its not sexure!



XmlDocument doc1 = new XmlDocument();
doc1.Load(url);
XmlElement root = doc1.DocumentElement;
XmlNodeList nodes = root.SelectNodes("/response/current_observation");

foreach (XmlNode node in nodes)
{
string tempf = node["node1"].InnerText;
string tempc = node["node2"].InnerText;


label2.Text = tempf;
label4.Text = tempc;


To read the data into a class, then show it in my application could be solution ??


No comments:

Post a Comment