Click here to Skip to main content
Licence 
First Posted 5 Jul 2001
Views 206,013
Bookmarked 52 times

How to create a virtual directory with C#

By | 5 Jul 2001 | Article
A simple example of using the DirectoryServices namespace in .NET

Sample Image - virtualdir.jpg

Introduction

This "how to" is only one more sample of how to use the DirectoryServices namespace in the Microsoft.Net framework. This sample uses IIS as its Active Directory provider. The access to Active Directory in .Net is so easy. You use System.DirectoryServices.dll for simple access.

I implemented a simple class called IISManager, it has two methods: Connect and CreateVirtualDirectory.

// To use it...
            
// Default constructor initialize the servername to localhost
// you could use IISManager(servername) 
IISManager isMang = new IISManager();
isMang.Connect();
try
{
	isMang.CreateVirtualDirectory(txtName.Text,txtPath.Text);
}
catch (Exception ex)
{
	MessageBox.Show(ex.Message);
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Gaston

Web Developer

Uruguay Uruguay

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionDoes not work properly with Windows 7 64 bit and VS 2010 PinmemberJVH35:33 5 Oct '11  
AnswerRe: Does not work properly with Windows 7 64 bit and VS 2010 PinmemberMarcus Kramer4:35 24 Jan '12  
GeneralUnable to create virtual directory in a remote machine using directory entry class Pinmembersanthoshkumars@zylog.co.in3:02 13 Oct '09  
GeneralSharing folder via internet... Pinmemberb00710:49 4 Nov '08  
Questionhow to access the files of public folder of a remote machine in vb.net window application Pinmemberkk_upadhyay20:16 27 Feb '08  
GeneralExample systray app to create/edit virtual directories PinmemberMonkeyBumps17:08 27 Nov '07  
GeneralModified CreateVirtualDirectory method to allow running ASP.Net App's PinmemberVahid_Nasiri20:48 24 Jun '07  
QuestionHow to Turn Off Anonymous Authentication PinmemberTom So8:41 12 Jan '07  
GeneralUnknown name exception while creating Virtual Directory on remote machine Pinmemberkdp_12317:45 6 Dec '06  
GeneralRe: Unknown name exception while creating Virtual Directory on remote machine Pinmemberpavankumarchakilam21:03 1 Apr '10  
GeneralNot works with Add method PinmemberYuri Kiselev0:00 22 Nov '06  
GeneralRe: Not works with Add method PinmemberWIROL0:04 18 Oct '07  
GeneralAnother way of creation and deletion of VD in 2.0 Pinmemberdigitally_urs2:35 17 Nov '06  
GeneralIIS Virtual Directory PinmemberSen K Mathew20:12 17 Jul '05  
GeneralRe: IIS Virtual Directory Pinmemberavidgator15:01 18 Aug '05  
QuestionHow do I create VD pointing to another site PinmemberKushal Prasad20:38 29 Mar '05  
GeneralI found this version Pinmemberalan_every3:10 18 Dec '03  
GeneralI am unable to set a path in the real path Pinmembervimalkd5:11 19 Oct '03  
GeneralRe: I am unable to set a path in the real path Pinmembercuongnle22:28 6 Aug '07  
GeneralRe: I am unable to set a path in the real path PinmemberWIROL0:09 18 Oct '07  
GeneralVirtual Directory not showing in Internet Services Manager PinmemberSeattleCoder11:04 23 Jun '03  
GeneralRe: Virtual Directory not showing in Internet Services Manager PinsussAnonymous0:45 28 Jun '05  
QuestionHow to Create a VD in non-Default web Site PinsussJShi8:51 21 Jun '03  
AnswerRe: How to Create a VD in non-Default web Site PinmemberPhoneTech6:22 10 Jul '03  
GeneralApplicationProtection Property. PinmemberKent Moyle17:49 28 May '03  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 6 Jul 2001
Article Copyright 2001 by Gaston
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid