title: Reading from the Registry in ASP.NET
body: <p>I have a Library ( DLL ) that has a method with the following:</p>
  
  <pre><code>var masterKey =      
      Registry.
      LocalMachine.
      OpenSubKey("SOFTWARE\\Microsoft\\Dynamics\\5.0\\");
  </code></pre>
  
  <p>When running this method in an WinForms applicaiton, <code>masterKey</code> is not null and when running this in asp.net <strong><code>masterKey</code> is null</strong>!</p>
  
  <p>I've checked the executing user with <code>WindowsIdentity.GetCurrent().Name</code> and the same user is executing both applications. The asp.net application is executed in visual studio ( debug: F5 ) and so is the WinForms application.</p>
  
  <blockquote>
    <p>How come I cannot read the key in
    asp.net?</p>
  </blockquote>
  
  <p><strong>Edit</strong></p>
  
  <p>I've set the permissions to none what so ever and this gives me "Access Denied". And when I add the group Users I get <code>null</code>. Which would mean that I can fold up the strucutre and see that it's there, but I cannot access the keys/entried.</p>
  
  <p>I am connected to a Domain, but this shouldn't affect my local instances of IIS, should it?</p>