Use an Isolated Store

Problem

You need to store data in a file, but your application doesn’t run with the required FileIOPermission.

Solution

Use a user-specific isolated store.

Discussion

The .NET Framework includes support for isolated storage, which allows you to read and write to a user-specific virtual file system that the common language runtime manages. When you create isolated storage files, the data is automatically serialized to a unique location in the user profile path (typically a path like c:\document and settings\[username]\local settings\application data\isolated storage\[guid_identifier]).

One reason you might use isolated storage is to give an untrusted application limited ability to store data. For example, the default common language ...

Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.