On Wed, 16 Jun 2004 11:07:39 -0400, "Mas G" <no**@none.com> wrote:
¤ Great Thanks
¤ but
¤ what Does serverID in DirectoryEntry root=new
¤ DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root"); mean
¤
¤ Its not server name again is it?
You have to query IIS in order to determine the server instance for the default web site. Here is
some simple VB code to do this:
Function FindInstanceIDForSite() As Integer
Dim intServerID As Integer
Dim objIIS As Object
On Error Resume Next
For intServerID = 1 To 512
Set objIIS = GetObject("IIS://Localhost/w3svc/" & intServerID)
If (Err.Number <> 0) Then
FindInstanceIDForSite = intServerID
MsgBox objIIS.ServerComment
Exit Function
End If
Next
FindInstanceIDForSite = 0
End Function
Paul ~~~
pc******@ameritech.net
Microsoft MVP (Visual Basic)