I have been trying to open a file on c: drive using Isolated Storage, I tried different ways but they all give the same error, here's the code;
IsolatedStorageFile ifs = IsolatedStorageFile.GetUserStoreForApplication();
Stream stream = new IsolatedStorageFileStream("avi.txt", FileMode.Open, Fil开发者_如何学CeAccess.Read, ifs);
I even tried:
1)
Stream stream = new IsolatedStorageFileStream(@"avi.txt", FileMode.Open, FileAccess.Read, ifs);
2)
Stream stream = new IsolatedStorageFileStream(@"files/avi.txt", FileMode.Open, FileAccess.Read, ifs);
3)
Stream stream = new IsolatedStorageFileStream("files/avi.txt", FileMode.Open, FileAccess.Read, ifs);
how can I open the file without using a Dialog box.
Thank you in advance
I can't explain the error you are seeing since I would gave expected to see file not found error.
It sounds to me that you are attempting to use isolated storage to access a file in the clients file system.
You need to be running an OOB with elevated trust. Then you can use System.IO.File to open a file and even then you are restricted to the MyDocuments area for the current user.
Outside of that you do need to show the user a dialog.
精彩评论