- Bad idea to give pgs unfettered access to a computer. THE SANDBOX OF LIMITED SECURITY.
- Q) Where do pgs that need to persist state go?
- A) Isolated Storage (IS). Now pgs can run as least-priveleged users + persist state without having to test whether app has enough rights to save data to the hard drive.
- Main benefit of isolated storage - app will run regardless of whether runing under partial, limited or full-trust.
How to Create a Store
- Before saving to isolated storage, one must determine how to scope the data in the store:
- mthd 1 - Assembly/Machine - creates a store that is specific to the calling assembly & lcl machine. Useful for application-level data.
- mthd 2 - Assembly/User - creates a store that is specific to the calling assembly & current user. Useful for user-level data.
- create assembly/machine store - IsolatedStorageFile machineStore = IsolatedStorageFile.GetMachineStoreForAssembly(); This IS is specific to the assembly that is calling it.
IsolateStorageFileStream
- encapsulates stream to read, write and create files in IS.
R/W
- r/w -> IS like r/w any other data into the file system.
- 1. Create a Store - IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForAssembly();
- 2. Create a Stream - IsolatedStorageFileStream userStream = new IsolatedStorageFileStream("UserSettings.set", FileMode.Create, userStore);
No comments:
Post a Comment