473,792 Members | 3,076 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 7842
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
47182
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
6707
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
3060
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
4
1618
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
1421
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
3032
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
23771
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
5083
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
9670
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
10430
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
10211
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...
1
10159
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
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
5436
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
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
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
3
2917
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.