Creating a suimple virtual directory with default rights

  • Thread starter Thread starter Microsoft
  • Start date Start date
M

Microsoft

I have a web site called www.test.com

I have a folder under the wwwroot called \testfolder\

How do I turn \testfolder\ into a virtual directory.

I don't need rights and settings, I've figured that part out, I just get
lost setting up the "System.DirectoryServices.DirectoryEntry" and then
executing the childern.add()
 
¤ I have a web site called www.test.com
¤
¤ I have a folder under the wwwroot called \testfolder\
¤
¤ How do I turn \testfolder\ into a virtual directory.
¤
¤ I don't need rights and settings, I've figured that part out, I just get
¤ lost setting up the "System.DirectoryServices.DirectoryEntry" and then
¤ executing the childern.add()
¤

See if the following helps:

Creating Sites and Virtual Directories Using System.DirectoryServices
http://msdn.microsoft.com/library/d..._directory_using_system_directoryservices.asp


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Great Thanks
but
what Does serverID in DirectoryEntry root=new
DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root"); mean

Its not server name again is it?
 
¤ 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 ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top