Visual Studio .NET 2002.NET 1.0Visual Basic 6Windows 2000Visual C++ 6.0IntermediateDevVisual StudioWindowsC++.NETVisual BasicC#
How to create a virtual directory with C#






4.30/5 (21 votes)
Jul 6, 2001

297766

6385
A simple example of using the DirectoryServices namespace in .NET
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); }