title: how to get license key from c#
body: <p>I am trying to create my own license system for my applications. Therefore, I am trying to read registry key but I couldnt do it succesfully.</p>
  
  <p>I have created a registry key manually and the code below doesnt read it.</p>
  
  <p>here is the regedit screen</p>
  
  <p><img src="https://i.stack.imgur.com/EMlpA.png" alt="enter image description here"></p>
  
  <p>here is my code below</p>
  
  <pre><code>// The Registry key we'll check
  
  // *********** it returns null**********************
  RegistryKey licenseKey = Registry.CurrentUser.OpenSubKey("Software\\Acme\\HostKeys");
  
  if ( licenseKey != null )  
  {
      // Passed the first test, which is the existence of the
      // Registry key itself. Now obtain the stored value
      // associated with our app's GUID.
      string strLic = (string)licenseKey.GetValue("test"); // reflected!
      if ( strLic != null ) 
      {
          // Passed the second test, which is some value
          // exists that's associated with our app's GUID.
          if ( String.Compare("Installed",strLic,false) == 0 )
          {
              // Got it...valid license...
              return new RuntimeRegistryLicense(type);
          } // if
      } // if
  } // if
  </code></pre>
  
  <p>what am I doing wrong?</p>