Brian Curless
Brian Curless

Reputation: 245

List all websites to textbox

Code example

Imports System.ServiceProcess
Imports System.Management
Imports System.Text.RegularExpressions
Imports System.Net.Sockets.TcpListener
Imports System.Text
Imports System.Net.NetworkInformation
Imports System
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Net
Imports System.Reflection
Imports System.Net.Sockets
Imports System.IO
Imports Microsoft.Web.Administration
Imports Microsoft.Web.Management



Private Sub GetAllSites()
    Dim iisManager As New ServerManager()
    Dim sitename As ArrayList = New ArrayList()
    sitename.Add(iisManager.Sites)
    For Each site As Object In sitename
        ListBox1.Items.Add(site)
    Next
End Sub

What i am trying to do is list all sites running in IIS on the local box, to the list box preferably in an array.

When the code executes it writes "(Collection)"

If anyone could tell when where i might be going wrong that would be greatly appreciated.

Upvotes: 0

Views: 174

Answers (1)

Anthony Fornito
Anthony Fornito

Reputation: 424

Try this should work

Private Sub GetAllSites()
    Dim iisManager As New ServerManager()
    For Each sitename In iisManager.Sites
        ListBox10.Items.Add(sitename)
    Next



End Sub

Upvotes: 1

Related Questions