Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Reading Registry of Email Server?


Message #1 by "Geeta Kalantre" <dotnetgeeta@h...> on Thu, 11 Oct 2001 14:32:18 +0000
   I am getting error while reading registry of Email Server.I have windws 

2000 and .NET beta 2 on my machine.I want to read the registry of our Email 

Server.For that I am using the OpenRemoteBaseKey function of RegistryKey 

class. Also I have userid & password which has admin rights for that Email 

Server.That is needed when I try to access Email Server from my 

computer.That is when I go through windows explorer and My Network Places.



   Here is the code that I am trying to execute:



try

{

Microsoft.Win32.RegistryKey clsRemoteRegKey=     

Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine,"EMAIL");

clsRemoteRegKey=clsRemoteRegKey.OpenSubKey("SOFTWARE\\Seattle 

Lab\\SLmail\\Users");

string[] sRemoteName=clsRemoteRegKey.GetValueNames();

Response.Write ( "<B><P>Count :</B> "+ 

clsRemoteRegKey.ValueCount.ToString());

}

catch(Exception err )

{

Response.Write ( "<B><P>An error occurred:</B> " +  err.ToString());

}



   But I am getting the following error when I try to execute the first line 

in above code. That is while executing the OpenRemoteBaseKey function.



   System.UnauthorizedAccessException: Access to the registry key is denied.



   Let me know what's wrong with that?



Thanks,

Geeta.

  Return to Index