473,804 Members | 3,855 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't delete Registry.LocalM achine subkey

I can delete RCan't delete Registry.LocalM achine
subkeyegistry.L ocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalM achine.OpenSubK ey(@"SOFTWARE\F irm\Application \Eurotax");
eurotaxKey.Dele teSubKey("pathD at");

I am administrator and regedit shows me that 'Administrators ' have full
control
on Eurotax key. I've also given 'All users' full control to this key and
still I get System.Unauthor izedException with message "Cannot write to the
registry key".

There's no problem deleting from Registry.Curren tUser.

--
Peri
Jan 31 '07 #1
3 7843
It may be to do with the CLR permissions that have been set.
What is the application type (web app/winform/service)

--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Peri" wrote:
I can delete RCan't delete Registry.LocalM achine
subkeyegistry.L ocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalM achine.OpenSubK ey(@"SOFTWARE\F irm\Application \Eurotax");
eurotaxKey.Dele teSubKey("pathD at");

I am administrator and regedit shows me that 'Administrators ' have full
control
on Eurotax key. I've also given 'All users' full control to this key and
still I get System.Unauthor izedException with message "Cannot write to the
registry key".

There's no problem deleting from Registry.Curren tUser.

--
Peri
Jan 31 '07 #2
"Peri" <em***@server.n etwrote in message news:op******** *******@at-piotrpe.atena.p l...
I can delete RCan't delete Registry.LocalM achine
subkeyegistry.L ocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalM achine.OpenSubK ey(@"SOFTWARE\F irm\Application \Eurotax");
eurotaxKey.Dele teSubKey("pathD at");

I am administrator and regedit shows me that 'Administrators ' have full
control
on Eurotax key. I've also given 'All users' full control to this key and
still I get System.Unauthor izedException with message "Cannot write to the
registry key".

There's no problem deleting from Registry.Curren tUser.

--
Peri

As I said in another reply you need to call OpenSubKey with the Writable flag set to true
like this:

Registry.LocalM achine.OpenSubK ey(@"SOFTWARE\F irm\Application \Eurotax", true);

Willy.
Jan 31 '07 #3
"Ciaran O''Donnell" <Ci************ @discussions.mi crosoft.comwrot e in message
news:4E******** *************** ***********@mic rosoft.com...
It may be to do with the CLR permissions that have been set.
What is the application type (web app/winform/service)
Not at all, System.Unauthor izedException "Cannot write to the
registry key", is a Windows permission issue not a code access issue.

Willy.

Jan 31 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
47187
by: Ed P. | last post by:
hello, I want to check to see if a certain registry key exists on the registry. What's the easiest way to do this. Here is what I am currently doing. private string registryKey = @"HKEY_LOCAL_MACHINE\Software\Techtracker" if(registryKey.Equals(Registry.Localmachine.CreateKey("Software").CreateKey("Techtracker").Name) MessageBox.Show("Registry Key Exists") els MessageBox.Show("Registry Key doesn't Exists")
4
6714
by: James | last post by:
I am trying to read values to the subkeys under HKLM\...\Uninstall. I get to this point... RegistryKey Sftw = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, name).OpenSubKey("software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("Uninstall"); foreach (string SubKey in Sftw.GetSubKeyNames()) {
3
3061
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
4
1619
by: Cal | last post by:
The Help examples for creating a Registry subkey uses double backslashes between subkeys. The examples for creating a folder use a single backslash. First: Am I right in that double backslashes are indeed needed with Registry methods? Second:Am I right in that single backslashes are indeed needed with folder descriptions?
0
1422
by: sxzy | last post by:
Hi, I use OpenRemoteBaseKey to open HKLM key on remote machine in same domain Code fails on OpenSubKey with error "Requested registry key is not allowed" I tried to give permissions to everyone on that registry key, lowering all .NET 1.1 permissions to full trust and to no avail. The only thing that worked was: <identity impersonate="true"/>
5
7959
by: Parv | last post by:
I am working in a domain environment. I am on a client machine and wants to edit registery of domain server. I am currently in a Domain user account and member of Domain administrators on the domain controller. I am able to open registry manully by connecting the remote registry. While doing the same programatically i am getting the following exception : CODE : RegistryKey baseKey =
2
927
by: Peri | last post by:
I can delete Registry.LocalMachine subkey using regedit. But not using code: RegistryKey eurotaxKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Firm\Application\Eurotax"); eurotaxKey.DeleteSubKey("pathDat"); I am administrator and regedit shows me that 'Administrators' have full control on Eurotax key. I've also given 'All users' full control to this key and still I get System.UnauthorizedException with message "Cannot write to...
3
3034
by: YXQ | last post by:
Hello, I need to programmatically take ownership of a registry-key as current user using VB2005. To test this , i created a key HKEY_LOCAL_MACHINE\Software\TestKey and removed all accessrights from this key using RegEdt32. Now i tried to set the accessrights by my programm. Since i do not have rights to this key, i cannot open the key to get a handle for modifying the rights.
3
23773
by: thephatp | last post by:
This is incredibly strange. I used regedit and went to HKEY_LOCAL_MACHINE and create a new subkey under "Software". I added a few more, then went into code to try to read them. I kept getting null returned when I tried to open them, so I decided to try this: Registry.LocalMachine.GetSubKeyNames() The results where dumbfounding--they did NOT match what I see in the Registry under HKEY_LOCAL_MACHINE. The list values returned from the...
5
5084
Sl1ver
by: Sl1ver | last post by:
I have this piece of code public bool Write(string KeyName, object Value) { try { // Setting string subKey1 = "SOFTWARE\\QwixAssets"; RegistryKey rk = Registry.LocalMachine; RegistryKey sk1 = rk.CreateSubKey(subKey1);
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.