473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to delete a registry key from an ASP.NET web service

I’m running an ASP.NET web service which dynamically creates a registry
key, stores some values in it, then, on a subsequent call to another
method in the service, attempts to delete the key. The problem is, the
delete operation always fails with the error message “Cannot write to
the registry key”. The program tries to create the key under
HKEY_CURRENT_US ER\some_name\<s ome GUID value>, but for some reason, it
gets created instead under HKEY_USERS\.DEF AULT\some_name\ <some GUID
value>. That doesn’t particularly bother me, though I am curious to
know why the key gets created there instead. But what does bother me is
that the service fails to delete the key and throws an exception. Does
it have anything to do with the stateless nature of the web service, and
that the delete is being attempted on a different thread from the one
that created it? In any case, this statement:

RegistryKey key = RegMainKey.Open SubKey(guidKey. ToString());

works correctly, but this one:

RegMainKey.Dele teSubKeyTree(gu idKey.ToString( ));

raises the exception. Why? How do I get around it?
Dec 13 '05 #1
2 1655
I wouldn't expect either operation to be successful... I'd assume that
the service runs under the ASPNET user, which shouldn't have
permissions to alter the registry.

(YMMV, I guess)

-j

Dec 13 '05 #2
because asp.net is a service, there is no current user (profile)

-- bruce (sqlwork.com)
"Robert Rotstein" <rr*******@veri zon.net> wrote in message
news:gwBnf.1417 $1b.55@trndny03 ...
I’m running an ASP.NET web service which dynamically creates a registry
key, stores some values in it, then, on a subsequent call to another
method in the service, attempts to delete the key. The problem is, the
delete operation always fails with the error message “Cannot write to the
registry key”. The program tries to create the key under
HKEY_CURRENT_US ER\some_name\<s ome GUID value>, but for some reason, it
gets created instead under HKEY_USERS\.DEF AULT\some_name\ <some GUID
value>. That doesn’t particularly bother me, though I am curious to know
why the key gets created there instead. But what does bother me is that
the service fails to delete the key and throws an exception. Does it have
anything to do with the stateless nature of the web service, and that the
delete is being attempted on a different thread from the one that created
it? In any case, this statement:

RegistryKey key = RegMainKey.Open SubKey(guidKey. ToString());

works correctly, but this one:

RegMainKey.Dele teSubKeyTree(gu idKey.ToString( ));

raises the exception. Why? How do I get around it?

Dec 13 '05 #3

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

Similar topics

2
20686
by: Peter Gomis | last post by:
I have encountered a situation where I am unable to remove a .NET assembly from the GAC. The message I receive is "Assembly 'assemblyname' could not be uninstalled because it is required by other applications." Although I have seen this before when trying to remove .NET assemblies that have been installed via an MSI package, I now get this message while trying to remove any assembly I've added to the GAC. Using gacutil does not work...
0
800
by: Maciek | last post by:
Hi When I set Session state mode to StateServer (IIS 6.0; windows2003; .NET 2.0) in my application, I have recived this message: ----------------------------------------------------------------------------------------------------------------- Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same. If the server is on a...
10
5003
by: robwharram | last post by:
Hi, I'm quite frustrated in the fact that I can't even display a simple "Hello World" message on .Net. I've been through all of the groups and searched all over the place and haven't been able to figure out the solution to this problem. First off, the server is Windows Server 2003 - Web Edition (IIS 6) and I'm using .Net Framework v1.1.4322.
22
3310
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to load DLL (aspnet_isapi.dll)." Of course the dll is able to be found, it's still in the framework directory and for grins I even put it in my service's local directory. This is apparantly server 2003 not allowing asp.net to be run if IIS was not...
0
12073
by: bazzer | last post by:
hey, im trying to access a microsoft access database from an ASP.NET web application in visual basic 2003.NET. i get the following error when i try running it: Server Error in '/CinemaBookingSystem' Application. -------------------------------------------------------------------------------- ERROR General error Unable to open registry key 'Temporary (volatile) Jet DSN for process
2
4691
by: letibal | last post by:
Hello, I have written a windows service and created an installer for it. The service runs under the system accounts. When started, it launches a GUI. By default, the InteractiveProcess property of the service is not set (this can be checked by right-clicking on the service in the Services window (Admin tools>Services), choosing Properties, LogOn tab). In order to enable my service to launch a GUI at startup, I added the following lines...
1
6796
by: ammar_fake | last post by:
Hello! I have an Oracle linked server connected through MSDAORA. Linked server queries work perfectly - the "openquery" ones as well as the 4-part-named ones. The problem I have is with embedding the queries within SQL Server triggers. Trigger: CREATE TRIGGER tgTest ON .
5
7716
by: Ajith Menon | last post by:
I have to install .NET framework 3.0. I already have .NET Framework 1.1 installed on my machine. I don't want to remove framework 1.1 since some of the critical applications are using it. While installing .NET framework 3.0 I got the error: "Microsoft .NET Framework 3.0 x86 has encountered a problem during setup. Setup did not complete correctly." Error Signature:
3
7845
by: Peri | last post by:
I can delete RCan't delete Registry.LocalMachine subkeyegistry.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
0
9721
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
9600
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
10628
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
10373
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
10113
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
9195
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
7651
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
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3859
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.