10

This page about storage quotas says to use the mscorcfg tool. BUT the mscorcfg page says the tool is only for older versions of .NET

So... what's the .NET 4 way of setting this value for desktop (not Silverlight) applications?

Robert Levy
  • 28,747
  • 6
  • 62
  • 94
  • The documentation claims it is stored as evidence with the assembly. I was able to us `storeadm.exe` to enumerate the stores on my machine, but I don't know how to adjust the evidence. – user7116 May 27 '11 at 21:21

2 Answers2

2

Taking a look at how this is done, it appears you will need to edit the Application Manifest using a tool like MageUI. If you open up your application's manifest and look under the Permissions Required entry you will see that most likely it has the Permission set type of FullTrust, i.e. no quota.

If you change the Permission set type to LocalIntranet or to Internet, you will see an entry in the Details area like so:

<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
             version="1"
             Allowed="AssemblyIsolationByUser"
             UserQuota="9223372036854775807"
             Expiry="9223372036854775807"
             Permanent="True"/>

Or

<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
             version="1"
             Allowed="ApplicationIsolationByUser"
             UserQuota="1024000"/>

You will likely need to edit the Permission set to include the IsolatedStorageFilePermission evidence, run your application, and have it Get/Create the User store. You can verify it worked with the proper quota using the storeadm.exe tool.

user7116
  • 63,008
  • 17
  • 141
  • 172
0

IsolatedStorage.IncreaseQuotaTo() should be what you want...

Camron B
  • 1,650
  • 2
  • 14
  • 30
  • "Currently, none of the hosts in the .NET Framework provide this customization, so IncreaseQuotaTo always returns false." [IsolatedStorageFile.IncreaseQuotaTo Method](http://msdn.microsoft.com/en-us/library/system.io.isolatedstorage.isolatedstoragefile.increasequotato.aspx) – user7116 May 27 '11 at 20:56
  • You are looking at the IsolatedStorageFile class, I pointed to the IsolatedStorage class. Have you tried with the IsolatedStorage class? – Camron B May 30 '11 at 14:01
  • 1
    I did sir, however, `IsolatedStorage` is an *abstract* base class. It has one concrete implementation `IsolatedStorageFile`, which does not implement `IncreaseQuotaTo` under the desktop hosts. – user7116 May 30 '11 at 15:19