Setting IsolatedStorage quota for .NET 4 desktop applications
Asked Answered
P

2

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?

Procora answered 18/5, 2011 at 14:51 Comment(1)
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.Macarthur
M
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.

Macarthur answered 27/5, 2011 at 21:34 Comment(0)
F
0

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

Fornix answered 27/5, 2011 at 20:55 Comment(3)
"Currently, none of the hosts in the .NET Framework provide this customization, so IncreaseQuotaTo always returns false." IsolatedStorageFile.IncreaseQuotaTo MethodMacarthur
You are looking at the IsolatedStorageFile class, I pointed to the IsolatedStorage class. Have you tried with the IsolatedStorage class?Fornix
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.Macarthur

© 2022 - 2024 — McMap. All rights reserved.