Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo

  How to create a suimple virtual directory with default rights (Monday, January 02, 2006)




Found the following interesting discussion in the Newsgroups:

Creating a suimple virtual directory with default rights
by: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()


 Reply:
by:Paul Clement

 

See if the following helps:

Creating Sites and Virtual Directories Using System.DirectoryServices
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iissdk/iis/creating_a_virtual_directory_using_system_directoryservices.asp


 Reply:
by:Mas G

 Great Thanks
but
what Does serverID in DirectoryEntry root=new
DirectoryEntry("IIS://localhost/W3SVC/" + serverID + "/Root"); mean

Its not server name again is it?


 Reply:
by:Paul Clement

 
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








0 Comments:

Post a Comment

 
Previous Posts
    - Multi column listboxes
    - Unicode to MS-DOS Cyrilic (code page 866)
    - Vb.net 2003 Get Text File
    - Program upgrades
    - RE: SQLCE Problem on Create Table
    - Q:Importing an Excel file into a VB application
    - Vb.net 2003 Get Text File
    - Changing design/apperance in excel from VB.NET
    - Visual Basic.net
    - How to remove NTFS Folder Permissions Using .NET

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006

Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland