Access to remote registry (RegistryPermissionAttribute)
From: Marc Wuergler (marc_wurgler_at_hotmail.com)
Date: 08/20/04
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: How do I send an s/mime e-mail using x509v3?"
- Previous message: Joakim Olesen: "Re: How do I send an s/mime e-mail using x509v3?"
- Next in thread: Shawn Farkas: "RE: Access to remote registry (RegistryPermissionAttribute)"
- Reply: Shawn Farkas: "RE: Access to remote registry (RegistryPermissionAttribute)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 20 Aug 2004 15:20:32 +0200
Hi !
I'm trying to access a registry key on a remote computer.
Here is my code :
[RegistryPermissionAttribute(SecurityAction.RequestMinimum, Read =
@"HKEY_LOCAL_MACHINE\SOFTWARE\MyKey")]
public static string ReadRegistryKey(string PsMachineName)
{
try
{
RegistryKey LoKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, PsMachineName);
RegistryKey LoSubKey = LoKey.OpenSubKey(@"SOFTWARE\MyKey");
string LsValue = LoSubKey.GetValue("InstallFolder").ToString();
return LsValue;
}
catch(Exception e)
{
return e.Message;
}
}
This code does not compile !!!
Error : Error emitting
'System.Security.Permissions.RegistryPermissionAttribute' attribute --
'Common Language Runtime Internal error: 0x8013143e'
Could anyone tell me what I'm doing wrong or how I can fix this !? Thanks a
lot.
Marc
- Next message: Joe Kaplan \(MVP - ADSI\): "Re: How do I send an s/mime e-mail using x509v3?"
- Previous message: Joakim Olesen: "Re: How do I send an s/mime e-mail using x509v3?"
- Next in thread: Shawn Farkas: "RE: Access to remote registry (RegistryPermissionAttribute)"
- Reply: Shawn Farkas: "RE: Access to remote registry (RegistryPermissionAttribute)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|