0

I want to save Xml Url content into text file using C# I tried this code

System.Xml.XmlTextReader _XmlTextReader = new System.Xml.XmlTextReader("http://www.w3schools.com/php/links.xml");
        string_xmlContent =_XmlTextReader.Readinnerxml();
        System.IO.File.WriteAllText("C:\users\vaio\desktop\new folder");

but it didn't work**

PS: sorry my English not very well

Lmooya
  • 23
  • 1
  • 2
  • possible duplicate of [How to download a file from a website in C#](http://stackoverflow.com/questions/525364/how-to-download-a-file-from-a-website-in-c-sharp) – Dmitrii Dovgopolyi Sep 13 '13 at 23:18
  • 1
    "it didn't work" is not a question anyone can answer. You have to tell us what happened, what you expected to happen, and why you think the two are different. – Dour High Arch Sep 14 '13 at 01:30

1 Answers1

0

Try this.

XmlDocument document = new XmlDocument();
document.Load("http://www.w3schools.com/php/links.xml");

File.WriteAllText("c:\\links.xml", document.InnerXml);
Ryan T. Grimm
  • 1,307
  • 1
  • 9
  • 17