views:

65

answers:

1

How can i get xml files from a web site and save it on pc. what is easy way with C# ?

+5  A: 

Use WebClient from the .NET library:

WebClient Client = new WebClient();
Client.DownloadFile("http://foo.bar", @"C:\filename.xml");
csl
i tried it but the server get error 404. But i can open the xml with the browser. The address is http://www.eshot.gov.tr/OtobusHareket/Hatlar/86_donus.xml
drorhan
@drorhan: That means you have probably used an incorrect URL. Are you using the internet through a proxy? That may also make a difference. See here for HTTP error codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
csl
no i do not use a proxy. i can open the page from firefox or ie. But the code gives me 404.
drorhan
The problem has solved. i guess the problem was from the server. thanks
drorhan