473,804 Members | 3,607 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 7844
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
47188
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
6715
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
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9579
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
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
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
5520
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...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.