tags:

views:

36

answers:

2

hello, when I'm trying to create a subkey in Registry.ClassesRoot I get an System.UnauthorizedAccessException! I'm using win7. Does anyone know why?

+2  A: 

Because only people in the Administrator group can create keys under HKEY_CLASSES_ROOT.

In general, you shouldn't need to be creating keys under there (if it's part of an install process, then you should probably be using a proper installer with transaction and rollback support - such as Windows Installer - not rolling your own).

But to solve your specific problem, then you need to run your application as Administrator.

Dean Harding
+1  A: 

Check that your program run as administrator. By default win7 does not run programs with admin permissions.

Itay
but how can I make my program from the beginning run as admin?
alex