Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I can't access the registry

Status
Not open for further replies.

destroyhead

Programmer
Feb 22, 2006
27
0
0
GB
Hi,

I have a very very simple code :

using System;

using System.Collections.Generic;

using System.Text;

using Microsoft.Win32;

namespace test

{

class Program

{

static void Main(string[] args)

{

RegistryKey hklm = Registry.LocalMachine;

RegistryKey hkSoftware = hklm.OpenSubKey("Software");

RegistryKey hkMicrosoft = hklm.OpenSubKey("Microsoft");

}

}

}



This does not work. I have this error related to the OpenSubKey() function :

"Request for the permission of type 'System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

It has been 2 days I am trying to find what is wrong on the Internet and I found nothing.

I am the administrator on my box, I can create Registry Keys and I have given full access to the VS Developer group.

Thanks a lot for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top