Tuesday, 29 April 2008

Isolated Storage (Quota.dat)

In my previous article i discovered that Isolated Storage directories are worth 1Kb

As a follow onto this, i look into where your Isolated Storage quota is stored (there will be a screencast on this also, once i suss out my silverlight streaming issues).

So the first point of call is where is my Isolated Storage held on disk (XP: C:\Documents and Settings\username\Local Settings\Application Data\Microsoft\Silverlight\is), (Vista: C:\users\ch3\appdata\locallow\Microsoft\Silverlight\is).

If we drill down that folder, we have a g folder, and an s folder. Beneath the S folder lies a folder for each isolated storage area (for each web application). Once you workout which folder relates to which application, there is a file called group.dat, which if you open up in notepad tells you a folder name in the g (group) folder.

So if we open that group folder we will see 4 files:


Now for the more astute readers. quota.dat is what holds your allocated isolated storage.

If we open quota.dat in Visual studio, we will see some Hex:

00 00 A0 00 00 00 00 00 00 00

Now my isolated storage quota for this application is 10Mb

A00000 in Hex is 10485760. If we divide 10485760 by 1048576 (1Mb (1024 bytes (1Kb) * (1024 bytes (1Kb)), we get a value of 10, i.e. 10Mb.

This is our isolated storage quota for this application.

This means when you call the method TryIncreaseQuotaTo(someValueInBytes) of the IsolatedStorageFile (and the user gives permission to increase the quota). Silverlight will modify the Hex value in this quota.dat file.

This means if you ever need to reduce the Isolated storage quota (there is no reduce method, see my article).

This now gives you to options:

1) Nuke the group (g) and storage (s) folders for the application :)

2) Modify the limit using visual studio :)

Anyways I hope this gives you a better understanding of how the Isolated Storage quota works internally.

In my next post, I will examine the used.dat file

No comments: