save regestry entries?

  • Thread starter Thread starter Elmar Jacobs
  • Start date Start date
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
 
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
 
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
 
Back
Top