title: DirectoryEntry.Properties["Path"].Value.ToString(); IIS7 issue. C#
body: <p>Currently getting <code>Unknown error (0x80005000)</code> - Linked to "COM Exception" in C# when running the following code
  <code>string virtualDirectory = GetVirtualDirPath("IIS://localhost", "1", reportUrl);</code></p>
  
  <pre><code>static string GetVirtualDirPath(string iisHost,
                                   string siteName, string vdName)
      {
          string adsiPath = iisHost + "/W3SVC/" + siteName + "/Root/test/" + vdName;
  
          try
          {
              DirectoryEntry entry = new DirectoryEntry(adsiPath);
              return entry.Properties["Path"].Value.ToString();
          }
          catch (Exception ex)
          {
              // If Virtual Directory is not found,
              // it will throw exception.
              return "";
          }
  
          return "";
      }
  </code></pre>
  
  <p>I have setup "share" as a Virtual Directory inside "/test" (http://localhost/test/share) and tried giving that folder relevant permissions.</p>
  
  <p>I have read that this only works in IIS6 and Not IIS7? If so, what is the equivalent code?</p>