G
Guest
Hello,
I have used Isolated Storage to store some user preferences, and now for
'non-technical reasons' our Major version number has changed on our
Assemblies.
But I do not want all users to lose their preferences, so I would like to
find a way to read the 'old' IsolatedStorage for version 5.2.2.2 of my
assembly from the 6.0.0.0 version code.
Isolated storage has this nice feature of giving you a new isolated storage
when the major version of the product (assembly) changes.. - but I need to
temporarilly bypass this feature.. (since I already saved the preferences
using GetUserStoreForAssembly in version 5.x)
I have tried code like the following:
I get an "Execution permission cannot be acquired" on the call to GetStore()
when I am passing my constructed evidence for the previous version of the
assembly. Is this because the previous version of the assembly is not
currently loaded ? - does it have to be loaded to use its 'evidence' ?
Does anyone have any ideas how to solve this general problem of reading the
Isolated storage of a previous version of the assembly ?
I think perhaps I should use a different method of opening the Isolated
storage in the future - does anyone have an example of how I could obtain
Version _Independant_ isolated storage based just on the simple name of the
assembly. (I guess I am looking for the opposite of the previous discussion
here on how to obtain completely version _Dependant_ Isolated storage..)
Thanks for any clues, hints or comments on similar attempts.
John F.
===
// Get the isolated store for this assembly - this is the original way -
but this isolated storage changes when major version changes,
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly();
// now try to get the isolated storage for the previous version 5.2.2.2
- so we don't lose it when they upgrade.
Byte [] mybytes;
int discarded;
mybytes =
HexEncoding.GetBytes("00240000048000009400000006020000002400005253413100040000010001000948995ae0b97702f4618ab704f5c138ca4ca9dec812590a64584c0244b1e0bbd05f11932199576e47d82bc5ee22ad40ea706348db50f90c49f55b8a11645d0fe748d01e115cbef570453f9d6f43a1655ae6d155f59c70ba6ea9f88f660c7343f25b4b5b7a3ba78893b26c880bc1529f56edc3aaf6ca9bea2ab2e7501fc875be",out discarded);
System.Security.Permissions.StrongNamePublicKeyBlob mypublickey = new
System.Security.Permissions.StrongNamePublicKeyBlob(mybytes);
System.Security.Policy.StrongName mysn = new
System.Security.Policy.StrongName(
mypublickey,"AccountableSoftwareInc.AnyViewInstall.DatabaseInstall",new
Version(5,2));
System.Security.Policy.Evidence myEvidence = new
System.Security.Policy.Evidence(null,null) ;
myEvidence.AddAssembly(mysn);
// next line throws exception : Execution permission cannot be acquired
//IsolatedStorageFile isf_oldversion =
IsolatedStorageFile.GetStore(IsolatedStorageScope.Assembly,null,null,myEvidence,typeof(System.Security.Policy.StrongName) );
===
I have used Isolated Storage to store some user preferences, and now for
'non-technical reasons' our Major version number has changed on our
Assemblies.
But I do not want all users to lose their preferences, so I would like to
find a way to read the 'old' IsolatedStorage for version 5.2.2.2 of my
assembly from the 6.0.0.0 version code.
Isolated storage has this nice feature of giving you a new isolated storage
when the major version of the product (assembly) changes.. - but I need to
temporarilly bypass this feature.. (since I already saved the preferences
using GetUserStoreForAssembly in version 5.x)
I have tried code like the following:
I get an "Execution permission cannot be acquired" on the call to GetStore()
when I am passing my constructed evidence for the previous version of the
assembly. Is this because the previous version of the assembly is not
currently loaded ? - does it have to be loaded to use its 'evidence' ?
Does anyone have any ideas how to solve this general problem of reading the
Isolated storage of a previous version of the assembly ?
I think perhaps I should use a different method of opening the Isolated
storage in the future - does anyone have an example of how I could obtain
Version _Independant_ isolated storage based just on the simple name of the
assembly. (I guess I am looking for the opposite of the previous discussion
here on how to obtain completely version _Dependant_ Isolated storage..)
Thanks for any clues, hints or comments on similar attempts.
John F.
===
// Get the isolated store for this assembly - this is the original way -
but this isolated storage changes when major version changes,
IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForAssembly();
// now try to get the isolated storage for the previous version 5.2.2.2
- so we don't lose it when they upgrade.
Byte [] mybytes;
int discarded;
mybytes =
HexEncoding.GetBytes("00240000048000009400000006020000002400005253413100040000010001000948995ae0b97702f4618ab704f5c138ca4ca9dec812590a64584c0244b1e0bbd05f11932199576e47d82bc5ee22ad40ea706348db50f90c49f55b8a11645d0fe748d01e115cbef570453f9d6f43a1655ae6d155f59c70ba6ea9f88f660c7343f25b4b5b7a3ba78893b26c880bc1529f56edc3aaf6ca9bea2ab2e7501fc875be",out discarded);
System.Security.Permissions.StrongNamePublicKeyBlob mypublickey = new
System.Security.Permissions.StrongNamePublicKeyBlob(mybytes);
System.Security.Policy.StrongName mysn = new
System.Security.Policy.StrongName(
mypublickey,"AccountableSoftwareInc.AnyViewInstall.DatabaseInstall",new
Version(5,2));
System.Security.Policy.Evidence myEvidence = new
System.Security.Policy.Evidence(null,null) ;
myEvidence.AddAssembly(mysn);
// next line throws exception : Execution permission cannot be acquired
//IsolatedStorageFile isf_oldversion =
IsolatedStorageFile.GetStore(IsolatedStorageScope.Assembly,null,null,myEvidence,typeof(System.Security.Policy.StrongName) );
===