IIS API

A

Anonymous

How do I programmatically list/enumerate the web sites in IIS from a c#
application?

I want to know which host headers each site responds to.
And I suppose there's other useful, per-site, info I also could use, total
size on disk, which framework they execute under, and such stuff.
 
J

Juan T. Llibre

re:
!> How do I programmatically list/enumerate the web sites in IIS from a c# application?

Call a WScript from your C# app...

Set IISOBJ = getObject("IIS://LocalHost/W3SVC")
For each Object in IISOBJ
if (Object.Class = "IIsWebServer") then
WScript.Echo "WWW Site: " & Object.Name & " - " & Object.ServerComment
end if
next

For a "pure" C# script which does what you want to do, see :

http://www.iisfaq.com/Default.aspx?tabid=3166

You could also, if you only have ASP.NET websites, call :

aspnet_regiis -lk

That will list all ASP.NET websites on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top