Working with the Isolated Storage API

IsolatedStorageScope.Assembly |

IsolatedStorageScope.Domain,

typeof(System.Security.Policy.Url),

typeof(System.Security.Policy.Url));

//Open or create a writable file within the store.

IsolatedStorageFileStream isoStream =

new IsolatedStorageFileStream("Enter_Identity_Here",

FileMode.OpenOrCreate,

FileAccess.Write,

FileShare.Write,

10240,

isoFile);

//reading from the store

byte inputChar = (byte)isoStream.ReadByte();

//writing

isoStream.WriteByte(inputChar);

//other common functions

String [] dirNames = isoFile.GetDirectoryNames("*");

String [] fileNames = isoFile.GetFileNames("Archive\\*");

As you can see, Isolated Storage is modeled on the file I/O routines, so there should be no significant learning curve.

There are certain benefits to using Isolated Storage:

         Security is managed for you.

         Storage is managed for you.

         The data contents are protected and isolated automatically.

         Store administration is available using the storeadm.exe utility.

Next time you need to store data, consider the Isolated Storage approach, and save yourself some time and effort.

Alvin Bruney ([email protected]) is a Technology Specialist working for Royal Bank of Canada in the .NET Centre of Excellence program. He is a Microsoft Press author and a longtime ASP.NET MVP.

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish