How to use the RegistryPermission Class

I recently created an application which stores values in the registry. Just recently I found out that some users are having problems because when running the application it apparently crashes because it doesnt have the correct permission to access the registry (I dont have many details about the error yet, so I doint know if it crashed when reading or writing). I did a couple quick googles and yahoos and found info about the registrypermission class, but I cant find any straight forward description of how to use it.

All the examples that I see, create a new instance of a registrypermission object (passing a permission and a registry path into the constructor), but then never do anything with the object! Is this how its used? Does just creating an instance of this object allow the application to access that registry key?

If not, please explain!

Thanks in advance,
willmrk
willmrkAsked:
Who is Participating?
 
Bob LearnedCommented:
Applying a strong name to an assembly, and then trusting it through a policy:

Code Access Security
http://www.codeproject.com/dotnet/UB_CAS_NET.asp

Granting rights to the Intranet through a wizard:

.NET Framework Configuration Tool (Mscorcfg.msc)
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cptools/html/cpconNETFrameworkAdministrationToolMscorcfgmsc.asp

Bob
0
 
Bob LearnedCommented:
Are you dead set on using the Registry, and not writing XML files?

Bob
0
 
willmrkAuthor Commented:
well, There are other applications that will use this information stored in the registry. The Applications aren't neccessarily running from the same directory.
0
 
Bob LearnedCommented:
Would you be able to get away with granting full trusting the assembly?

Bob
0
 
willmrkAuthor Commented:

Sorry for my ignorance, but what exactly does that mean?

the "granting full trusting"...

Is this a setting that would have to be done on the PC after the application is installed?
Or is this configured via the code in my application?
What implications does it have to "grant full trusting" of an assembly?

Thanks again for your assistance!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.