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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Bob
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.
Bob LearnedCommented:
Would you be able to get away with granting full trusting the assembly?

Bob
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!
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.