Create folder programmatically under IIS Web Site

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Roisentul

    Create folder programmatically under IIS Web Site

    Hi All,

    I want to programmaticall y(c# fmw 2.0) create a folder under my IIS
    Web Site. I figured that I needed to create an entry in the IIS
    Metabase.

    So, after investigating a while and i figured out something pretty
    weird:

    I downloaded a source code that allowed me to do what I wanted.
    However, it's written in asp.net v1.0 and I needed in v2.0. So, I
    converted it to that version.

    Well, you all can imagine it must have worked, but you're wrong: it
    didn't (i'm pretty sure is that because i tried: copying the
    procedures and functions I needed to a asp.net v2.0 project. Then,
    after the last try didn't work, I tried converting the entire solution
    to v2.0 and it did it successfully).

    I don't know why, but the v1.0 application is able to create the entry
    at the metabase under my virtual directory(IIS://localhost/W3SVC/<web
    site id>/root/<new dir's name>) but when I try to do the same using
    the v2.0 app i get the following error:

    System.Runtime. InteropServices .COMException (0x80070003): The system
    cannot find the path specified.

    at System.Director yServices.Direc toryEntry.Bind( Boolean
    throwIfFail)
    at System.Director yServices.Direc toryEntry.Bind( )
    at System.Director yServices.Direc toryEntry.get_A dsObject()
    at System.Director yServices.Prope rtyValueCollect ion.PopulateLis t()
    at
    System.Director yServices.Prope rtyValueCollect ion..ctor(Direc toryEntry
    entry, String propertyName)
    at System.Director yServices.Prope rtyCollection.g et_Item(String
    propertyName)
    at Example.Form1.s etDirectory_Cli ck(Object sender, EventArgs e)
    at System.Windows. Forms.Control.O nClick(EventArg s e)
    at System.Windows. Forms.Button.On Click(EventArgs e)
    at System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
    at System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
    button, Int32 clicks)
    at System.Windows. Forms.Control.W ndProc(Message& m)
    at System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
    at System.Windows. Forms.Button.Wn dProc(Message& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
    at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
    msg, IntPtr wparam, IntPtr lparam)

    Do you have any clue on this?

    Thanks,

    Brian
Working...