Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to write in registries on my windows seven but its in showing an exception that Its not able to write in registry due to security reasons. Please help me to get ride of this problem. Please suggest me some solution through code.

thanks in advance
Posted
Comments
Maciej Los 11-May-12 2:48am    
OK, we can help, but we can't read in your mind. Show us what have you done until now... Explain where is a problem... What kind of error do you have...

look at article Analog Digital Clock Screen Saver and App

see class RegistryWrapper
 
Share this answer
 
v2
Comments
Prasad_Kulkarni 11-May-12 2:54am    
Where's the article John, I think you miss'd the link.
John Orendt 11-May-12 3:12am    
Try codeproject search
Prasad_Kulkarni 11-May-12 3:13am    
What i would suggest that give proper link for OP, then only it will considered as answer.

Wait I will do it for you.
John Orendt 11-May-12 5:03am    
Thanks
It depends on the part of the registry you want to write to. You can write into HKey_Current_User.
When you want to write into HKey_Local_Machine, add a manifest to your application, stating requestedExecutionLevel level="requireAdministrator". See also http://msdn.microsoft.com/en-us/library/bb756929.aspx[^].
But think again whether it is really necessary to write data to that part of the registry. Often, a configuration file in %programdata%\Company Name\Product Name is more appriopriate.
 
Share this answer
 
Hello,

I use this before my methods to give that method proper permissions:

C#
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]


Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900