I have to read a xml file existing on the c drive of the client machine. I have written the server side code as shown below:--
XmlTextReader objXmlTextReader = new XmlTextReader(@"C:\xxx\XYZ.xml");
while (objXmlTextReader.Read())
{
// My logic goes here.
switch (objXmlTextReader.NodeType)
{
case XmlNodeType.Element:
sName = objXmlTextReader.Name;
break;
case XmlNodeType.Text:
switch (sName)
{
case "Name":
{
comboBox1.Items.Add(objXmlTextReader.Value);
break;
}
}
break;
}
}
objXmlTextReader.Close();
But it reads the xml file located on the server. Although it's a funny code to demonstrate. It might help you to understand my actual requirement.