We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

View Complete Thread
  • Re: Web Diecrectory (IisWebDirectory) Vs Web Virtual Directory (IisWebVirtualDir)

    Sep 19, 2007 11:31 PM|steve schofield|LINK

    Are you reading the metabase or the physical folder path?  A virtual directory is just that, 'a virtual directory'.  It is a pointer to a physical folder on disk.  Check out MSDN for more programming related documentation.



    If you are querying a physical directory path, I would use the Server.MapPath method to obtain the physical path, assuming that is what you want.  Otherwise, the System.DirectoryServices Namespace would be used to query the metabase.    Here is some code I used in IISLogsGUI that helps set properties.  It has an example of setting values in a datatable .    Hope this helps point you in the right direction.

        Private Sub SetData(ByVal SvcType As String)
                Dim EN As DirectoryEntry = New DirectoryServices.DirectoryEntry("IIS://LOCALHOST/" & SvcType)
                For Each Entry As DirectoryEntry In EN.Children
                    If IsNumeric(Entry.Name) = True Then
                        Dim DR As DataRow = CType(Me.DataGrid1.DataSource, DataTable).NewRow
                        With DR
                            .Item("Select") = 0
                            .Item("Directory") = Entry.Properties.Item("LogFileDirectory").Value
                            Select Case SvcType.Trim.ToLower
                                Case "w3svc"
                                    .Item("Type") = "WWW"
                                    .Item("Directory") &= "\w3svc" & Entry.Name
                                Case "msftpsvc"
                                    .Item("Type") = "FTP"
                                    .Item("Directory") &= "\msftpsvc" & Entry.Name
                                Case "smtpsvc"
                                    .Item("Type") = "SMTP"
                                    .Item("Directory") &= "\smtpsvc" & Entry.Name
                                Case "nntpsvc"
                                    .Item("Type") = "NNTP"
                                    .Item("Directory") &= "\nntpsvc" & Entry.Name
                            End Select
                             .Item("ID") = Entry.Name
                            .Item("Name") = Entry.Properties.Item("ServerComment").Value

                        End With
                        CType(Me.DataGrid1.DataSource, DataTable).Rows.Add(DR)
                    End If
            Catch ex As Exception
            End Try
        End Sub 


    Steve Schofield
    Windows Server MVP - IIS
    Log archival solution
    Install, Configure, Forget