save regestry entries?

E

Elmar Jacobs

hy guys,

i tray to save regestry entries over an asp page. but i get the hole time
UnauthorizedAccessExceptions.
the code from the apsx.cs file is:

/// <summary>

/// Open or Create Sub Key in Registry.

/// </summary>

protected RegistryKey CreateRegistrySubKey(string path)

{

RegistryKey regKey = null;

try {regKey = Registry.LocalMachine.CreateSubKey(path);}

catch(ArgumentNullException) {return regKey;}

catch (ArgumentException) {return regKey;}

catch (UnauthorizedAccessException) {return regKey;}

return regKey;

}

public static path = "SOFTWARE\\settings";

do anybody knows why i have no access to the regestry? I am lock in as an
administrator.

wich best regards,

elmar
 
S

Steve C. Orr [MVP, MCSD]

The default ASPNET user account does not have permissions to edit the
registry.
You can give it permissions by following these steps:

1) Start Regedit.
2) Right click on a node and select "Permissions..."
3) Give the ASPNET account Full Control for that node. Under the advanced
button you can tell it to assign the same permissions to any child nodes as
well.

Or you can use impersonation to have ASP.NET run under a different user
account that has permissions to the registry.
Here's more info on impersonation:
http://msdn.microsoft.com/library/d...-us/cpguide/html/cpconaspnetimpersonation.asp
 
E

Elmar Jacobs

hi steve,

thanks a lot. it work ;)
a additional information to the group:
the permission possibility you can only see in the regedit.exe or
regedt32.exe of the pc. not in the eVC reg editor tool.

thanks a lot,
elmar
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top