Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting IsolatedStorage quota for .NET 4 desktop applications

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?

like image 953
Robert Levy Avatar asked May 18 '11 14:05

Robert Levy


1 Answers

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.

like image 146
user7116 Avatar answered Oct 13 '22 00:10

user7116