Click here to Skip to main content
15,905,414 members
Articles / Programming Languages / Visual Basic
Article

How to create a virtual directory with C#

Rate me:
Please Sign up or sign in to vote.
4.30/5 (24 votes)
5 Jul 2001 294.8K   6.4K   59   45
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


Written By
Web Developer
Uruguay Uruguay
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralRe: I Have the same problem Pin
hackaroy28-Apr-04 13:11
hackaroy28-Apr-04 13:11 

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

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