Reputation: 11
I'm working on my thesis project and I need to open and read a file from a website. I couldn't find anything. How can I do that?
Upvotes: 1
Views: 1120
Reputation: 746
You can only IsolatedStorage for file IO in Windows Phone 7
For downloading the text file, the easiest way would probably to use the WebClient's DownloadString() method. Then write the contents of this file to the IsolatedStorage.
This might also interest you: http://weblogs.asp.net/gunnarpeipman/archive/2010/05/06/windows-phone-7-development-using-isolated-storage.aspx
Upvotes: 0
Reputation: 164281
Use WebClient. If you just want the contents as a string, it could be something like:
WebClient cli = new WebClient();
cli.DownloadStringCompleted += // your completed handler
cli.DownloadStringAsync(uri);
Because all network IO on WP7 is asynchronous, you have to attach an event handler and wait for the event to be raised before you get the data.
Upvotes: 1
Reputation: 11
well,HttpRequest can reads the file,but i need to download the file before reading it,i need to change some variables inside the txt file
and this is the file that i download
http://dhmi.gov.tr/UcusBilgileri/1/domarr.txt
Upvotes: 0
Reputation: 14994
Check the HttpWebRequest Class. This video should help you also.
Upvotes: 0