Unable to write to Windows Registry using XML Web Service

A

Alexander Pino

Hiya,

at this very moment I'm trying to write an XML Web Service for reading and
writing configuration/registry settings.
But for some reason I can read from the registry
('HKEY_LOCAL_MACHINE\SOFTWARE') but I do not seem to be able to create keys.

The moment I call RegistryKey.OpenSubKey(whatever, true) or
RegistryKey.CreateSubKey(whatever) a 'System.Security.SecurityException' is
raised. and tells me 'Requested registry access is not allowed'.

Does anyone now how I can solve this problem?

ps. I really have to use the registry, because that already exists from
older native company products.


Kind regards,
Alexander
 
J

Jan Tielens

This is because the user account your web service uses (probably the ASPNET
account) has not enough rights to modify the registry keys. Using RegEdit
you can change the permissions for each registry key. Or you could grant
your ASPNET account more rights, or use another account for your web
service.
 
R

Ray Deese

I believe you wil probably need to impersonate another user with more rights in order to make any changes to the registry. I'm against giving the ASPNET account more privileges for obvious reasons. Just impersonate another local user which has more rights and you should be OK. Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top