title: IIS 6.0 programmatically - Problem creating virtual directories AND not setting it as a Application
body: <p>So I am creating a virtual directory in IIS  6.0 programmically, but I am following the only MSDN (or other) documentation on creating a virtual directory, but the documentation I have at </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/ms525598(VS.90).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms525598(VS.90).aspx</a> </p>
  
  <p>Is causing my virtual directory to be an application in IIS.  I was trying to use the metabase properties page:</p>
  
  <p><a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/cde669f1-5714-4159-af95-f334251c8cbd.mspx?mfr=true" rel="nofollow">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/cde669f1-5714-4159-af95-f334251c8cbd.mspx?mfr=true</a></p>
  
  <p>But in the sea of options I am not sure what properties I need to set to stipulate it strictly as a virtual directory:</p>
  
  <pre><code>DirectoryEntries vdirs = site.Children;
  DirectoryEntry newVDir = vdirs.Add(vDirName, (className.Replace("Service", "VirtualDir")));
  
  newVDir.Properties["Path"][0] = phyPath;
  newVDir.Properties["AccessScript"][0] = true;
  newVDir.Properties["AppFriendlyName"][0] = vDirName;
  newVDir.Properties["AppIsolated"][0] = "0";
  newVDir.Properties["AppRoot"][0] = "/LM" + metaBaseFullPath.Substring(metaBaseFullPath.IndexOf("/", ("IIS://".Length)));
  
  newVDir.CommitChanges();
  </code></pre>