C#-MSI Set ASP Version on Virtual Directory

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Yonger
    New Member
    • Dec 2006
    • 6

    C#-MSI Set ASP Version on Virtual Directory

    Need to create virtual directories from a MSI .dll. Code is working fine now but when I install on a clean machine it's defaulting to ASP version 1.1. Need to find a way to set to 2.0. Current code is below...

    DirectoryEntry deRoot = new DirectoryEntry( "IIS://localhost/W3SVC/1/Root");
    deRoot.RefreshC ache();
    DirectoryEntry deNewVDir = deRoot.Children .Add("NewDir", "IIsWebVirtualD ir");
    deNewVDir.Prope rties["Path"].Clear();
    deNewVDir.Prope rties["Path"].Insert(0, NewDirPath);
    deNewVDir.Commi tChanges();
    deRoot.CommitCh anges();
    deNewVDir.Invok e("AppCreate" , true);
    deNewVDir.Commi tChanges();
    deRoot.CommitCh anges();
    deNewVDir.Close ();
    deRoot.Close();


    Any ideas?
  • Yonger
    New Member
    • Dec 2006
    • 6

    #2
    This is the only way I've been able to get it to work...but seems to be working for me.

    ProcessStartInf o p = new ProcessStartInf o("C:\\WINDOWS\ \Microsoft.NET\ \Framework\\v2. 0.50727\\aspnet _regiis.exe");
    p.Arguments = " -s W3SVC/1/Root/NewDirPath";
    p.UseShellExecu te = false;
    p.CreateNoWindo w = true;
    Process proc = new Process();
    proc.StartInfo = p;
    proc.Start();

    basically just calling the aspnet_regiis from the directory of the version of .NET I want the app to be using.

    Comment

    Working...