473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Can't delete Registry.LocalMachine subkey

I can delete RCan't delete Registry.LocalMachine
subkeyegistry.LocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Firm\A pplication\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 the
registry key".

There's no problem deleting from Registry.CurrentUser.

--
Peri
Jan 31 '07 #1
3 7775
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.LocalMachine
subkeyegistry.LocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Firm\A pplication\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 the
registry key".

There's no problem deleting from Registry.CurrentUser.

--
Peri
Jan 31 '07 #2
"Peri" <em***@server.netwrote in message news:op***************@at-piotrpe.atena.pl...
I can delete RCan't delete Registry.LocalMachine
subkeyegistry.LocalMachine subkey using regedit. But not using
code:
RegistryKey eurotaxKey =
Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Firm\A pplication\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 the
registry key".

There's no problem deleting from Registry.CurrentUser.

--
Peri

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

Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Firm\A pplication\Eurotax", true);

Willy.
Jan 31 '07 #3
"Ciaran O''Donnell" <Ci************@discussions.microsoft.comwrote in message
news:4E**********************************@microsof t.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.UnauthorizedException "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
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 =...
4
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,...
3
by: Slimo | last post by:
Hello, I'm searching some example of code (VB) for reading remote registry subkeys and keys. Thanks
4
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...
0
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...
5
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...
2
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");...
3
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...
3
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...
5
Sl1ver
by: Sl1ver | last post by:
I have this piece of code public bool Write(string KeyName, object Value) { try { // Setting string subKey1 =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...

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.