Chapter 32. System.IO.IsolatedStorage

System.IO.IsolatedStorage allows you to access an isolated area of a filesystem for your application. This is useful when access to the System.IO classes is not possible. The security settings of the .NET Framework prohibit web applications and downloaded controls from accessing the local filesystem directly, but those settings allow them to use System.IO.IsolatedStorage. Applications’ storage areas are isolated from one another, so anything in isolated storage is protected from untrusted applications. The size of isolated storage is limited, so an untrusted application cannot create a denial-of-service condition by filling your hard disk with data.

When you use isolated storage, the runtime sets aside disk space for a given level of isolation (specified using IsolatedStorageScope). If you use Windows 2000 or XP, <SYSTEMDRIVE>\Documents and Settings\<user>\Application Data contains the isolated storage area if roaming is turned on, and <SYSTEMDRIVE>\Documents and Settings\<user>\Local Settings\Application Data contains the storage area if roaming is not on. Applications can use this area as a data store for their particular persistence needs. Figure 32-1 shows the inheritance diagram for this namespace. For more information, see Section 10.4 in Chapter 10.

The System.IO.IsolatedStorage namespace

Figure 32-1. The System.IO.IsolatedStorage namespace

Get C# in a Nutshell 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.