简体   繁体   中英

Get Isolated Storage path for UWP

I have learned about Isolated Storage . I want to store my SQLite Db in Isolated Storage. How can I get isolates Storage path for UWP app.

The article at your link clearly states that these APIs were deprecated long time ago and they are not available for Windows 8 and newer apps. If you are trying to build secure UWP app, store encrypted database in the one of special folders provided by ApplicationData class and keep password in the PasswordVault .

You don't need to (or should) know the path to be able to create a file using the IsolatedStorageFile API:

IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication();
IsolatedStorageFileStream fileStream = storage.CreateFile("myfile.txt");

If you really want it, you could use reflection:

string path = typeof(IsolatedStorageFileStream)
    .GetField("_fullPath", BindingFlags.Instance | BindingFlags.NonPublic)
    .GetValue(fileStream)
    .ToString();

But you should not rely on the absolute path anywhere in your app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM