March 20, 2019
Hot Topics:

Take Advantage of Isolated Storage with .NET

  • November 3, 2004
  • By Mike Amundsen
  • Send Email »
  • More Articles »

Testing the IsoStorage Class

Below is a simple console application that gets an instance of the AppItems collection, adds several AppItem objects to the collection, and then stores the collection on disk. Finally, it reads that same collection from the disk and echoes the name/value pairs to the console. The following is the complete code for this test app:

using System;
using amundsen.Utility;

public class IsoConsole
    public static void Main()
        AppItems writeItems = new amundsen.Utility.AppItems();
        writeItems.Add(new AppItem("name","mike"));
        writeItems.Add(new AppItem("amount",13.5));
        writeItems.Add(new AppItem("datepaid",System.DateTime.Now));

        amundsen.Utility.IsoStorage iso = new amundsen.Utility.


        AppItems readItems = iso.ReadAppCollection("testing.txt");

        for(int i=0;i<readItems.Count;i++)
            AppItem item = (AppItem)readItems[i];

Below is the resulting output when you run the above code:

Click here for a larger image.

But where, you might ask, is this information stored on the disk? It depends on which Windows OS you are using and whether it was a fresh install or an upgrade from an older OS. However, clean installs of XP and Windows 2003 store the data in a unique folder name within <SYSTEMDRIVE>\Documents and Settings\<user>\Local Settings\Application Data. They store roaming profiles in a different location. When I ran this example on my machine, the OS stored the testing.txt file in a folder called AssemFiles at this location:

C:\Documents and Settings\MCA\Local Settings\Application Data\IsolatedStorage\i3ltsz13.04j\ybsvcgd0.iwo\Url.jw0fj4okszugu4hi3vglikpjpr4ih0nd

A Safe Place for Your Data

Now you know that .NET provides a safe location for storing application- and user-specific data. You've also learned how to access this isolated storage space and how to build a simple utility class that can easily read and write name/value pairs to it.

Download the Code

To download the accompanying source code for this article, click here.


Mike Amundsen, an author and lecturer, has more than a dozen Microsoft programming books to his credit. Most recently, he covered Web development using Microsoft's .NET Framework in the Sams Publishing title ASP.NET for Developers.

Page 2 of 2

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date