There seems to be no real solution to this problem. The default path for isolated storage under Windows XP is <SYSTEMDRIVE> \ Documents and Settings \\ Local Settings \ Application Data \ Microsoft \ Silverlight \ on the English system, which is already very large. On MSDN , a good article on using isolated storage and best practices.
When you use isolated storage, following these guidelines will help you avoid problems and make the most of isolated storage.
- Wrap all calls to isolated storage in try / catch blocks so that they are resistant to potential Insulators that can be thrown if isolated storage is disabled or if storage has been removed.
- If your Silverlight application needs to store a lot of data in isolated storage, consider placing it on your own site so that it does not affect other applications on the site and other applications will not affect it.
- If you have a group of Silverlight applications that need to share customer information, host them on one site.
- Keep isolated storage paths as small as possible to prevent the internal full path from reaching the 260 character limit.
- Encrypt sensitive data stored in isolated storage.
- Use IsolatedStorageSettings to store objects and simple settings in isolated storage.
- Use IsolatedStorageFile if you want to use a file and stream-based APIs that store large amounts of data or require fine-grained control over the contents of isolated storage.
To get around a PathToLongException, you can first check the path to the Sandbox and use the internal mapping to store your files in IsolStorage. If the path to IsolStorage is too long on its own, you should consider hosting a silverlight application on its own website and use IsolatedStorageFile.GetUserStoreForSite .
Jehof
source share