Click here to Skip to main content
12,300,379 members (25,515 online)
Click here to Skip to main content
Add your own
alternative version

Stats

247.5K views
5.5K downloads
57 bookmarked
Posted

How to create a virtual directory with C#

, 5 Jul 2001
Rate this:
Please Sign up or sign in to vote.
A simple example of using the DirectoryServices namespace in .NET
<!-- Download Links --> <!-- Article image -->

Sample Image - virtualdir.jpg

<!-- Main HTML starts here -->

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

Share

About the Author

Gaston
Web Developer
Uruguay Uruguay
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionDoes not work properly with Windows 7 64 bit and VS 2010 Pin
JVH35-Oct-11 5:33
memberJVH35-Oct-11 5:33 
AnswerRe: Does not work properly with Windows 7 64 bit and VS 2010 Pin
Marcus Kramer24-Jan-12 4:35
memberMarcus Kramer24-Jan-12 4:35 
GeneralUnable to create virtual directory in a remote machine using directory entry class Pin
santhoshkumars@zylog.co.in13-Oct-09 3:02
membersanthoshkumars@zylog.co.in13-Oct-09 3:02 
GeneralSharing folder via internet... Pin
b0074-Nov-08 10:49
memberb0074-Nov-08 10:49 
Questionhow to access the files of public folder of a remote machine in vb.net window application Pin
kk_upadhyay27-Feb-08 20:16
memberkk_upadhyay27-Feb-08 20:16 
GeneralExample systray app to create/edit virtual directories Pin
MonkeyBumps27-Nov-07 17:08
memberMonkeyBumps27-Nov-07 17:08 
GeneralModified CreateVirtualDirectory method to allow running ASP.Net App's Pin
Vahid_Nasiri24-Jun-07 20:48
memberVahid_Nasiri24-Jun-07 20:48 
QuestionHow to Turn Off Anonymous Authentication Pin
Tom So12-Jan-07 8:41
memberTom So12-Jan-07 8:41 
GeneralUnknown name exception while creating Virtual Directory on remote machine Pin
kdp_1236-Dec-06 17:45
memberkdp_1236-Dec-06 17:45 
GeneralRe: Unknown name exception while creating Virtual Directory on remote machine Pin
pavankumarchakilam1-Apr-10 21:03
memberpavankumarchakilam1-Apr-10 21:03 
GeneralNot works with Add method Pin
Yuri Kiselev22-Nov-06 0:00
memberYuri Kiselev22-Nov-06 0:00 
GeneralRe: Not works with Add method Pin
WIROL18-Oct-07 0:04
memberWIROL18-Oct-07 0:04 
GeneralAnother way of creation and deletion of VD in 2.0 Pin
digitally_urs17-Nov-06 2:35
memberdigitally_urs17-Nov-06 2:35 
GeneralIIS Virtual Directory Pin
Sen K Mathew17-Jul-05 20:12
memberSen K Mathew17-Jul-05 20:12 
GeneralRe: IIS Virtual Directory Pin
avidgator18-Aug-05 15:01
memberavidgator18-Aug-05 15:01 
QuestionHow do I create VD pointing to another site Pin
Kushal Prasad29-Mar-05 20:38
memberKushal Prasad29-Mar-05 20:38 
GeneralI found this version Pin
alan_every18-Dec-03 3:10
memberalan_every18-Dec-03 3:10 
GeneralI am unable to set a path in the real path Pin
vimalkd19-Oct-03 5:11
membervimalkd19-Oct-03 5:11 
GeneralRe: I am unable to set a path in the real path Pin
cuongnle6-Aug-07 22:28
membercuongnle6-Aug-07 22:28 
GeneralRe: I am unable to set a path in the real path Pin
WIROL18-Oct-07 0:09
memberWIROL18-Oct-07 0:09 
GeneralVirtual Directory not showing in Internet Services Manager Pin
SeattleCoder23-Jun-03 11:04
memberSeattleCoder23-Jun-03 11:04 
GeneralRe: Virtual Directory not showing in Internet Services Manager Pin
Anonymous28-Jun-05 0:45
sussAnonymous28-Jun-05 0:45 
QuestionHow to Create a VD in non-Default web Site Pin
JShi21-Jun-03 8:51
sussJShi21-Jun-03 8:51 
AnswerRe: How to Create a VD in non-Default web Site Pin
PhoneTech10-Jul-03 6:22
memberPhoneTech10-Jul-03 6:22 
GeneralApplicationProtection Property. Pin
Kent Moyle28-May-03 17:49
memberKent Moyle28-May-03 17:49 
GeneralRe: ApplicationProtection Property. Pin
christian[daedalus]19-Oct-04 5:02
memberchristian[daedalus]19-Oct-04 5:02 
QuestionHow to implement in ASP.NET? Pin
PhoneTech23-Feb-03 6:43
memberPhoneTech23-Feb-03 6:43 
AnswerRe: How to implement in ASP.NET? Pin
darony13-Jul-04 0:13
memberdarony13-Jul-04 0:13 
AnswerSolution for ASP.NET! Pin
Sire40417-Oct-04 23:20
memberSire40417-Oct-04 23:20 
QuestionHow do you delete Virtual Directory? Pin
ahaddad20-Feb-03 8:18
memberahaddad20-Feb-03 8:18 
AnswerRe: How do you delete Virtual Directory? Pin
Anonymous24-Jul-03 3:39
sussAnonymous24-Jul-03 3:39 
GeneralRe: How do you delete Virtual Directory? Pin
Anonymous18-Nov-04 22:55
sussAnonymous18-Nov-04 22:55 
AnswerRe: How do you delete Virtual Directory? Pin
kalph12-Dec-05 22:13
memberkalph12-Dec-05 22:13 
AnswerRe: How do you delete Virtual Directory? Pin
kalph12-Dec-05 22:17
memberkalph12-Dec-05 22:17 
AnswerRe: How do you delete Virtual Directory? Pin
Member 314043814-Jan-08 0:58
memberMember 314043814-Jan-08 0:58 
AnswerRe: How do you delete Virtual Directory? Pin
Member 314043814-Jan-08 1:00
memberMember 314043814-Jan-08 1:00 
GeneralI solved this problem. Pin
kind51114-May-02 22:16
memberkind51114-May-02 22:16 
GeneralRe: I solved this problem. Pin
Orion Buttigieg17-May-02 6:29
memberOrion Buttigieg17-May-02 6:29 
GeneralRe: I solved this problem. Pin
kind5119-Jun-02 16:46
memberkind5119-Jun-02 16:46 
GeneralRe: I solved this problem. Pin
Orion Buttigieg10-Jun-02 4:47
memberOrion Buttigieg10-Jun-02 4:47 
GeneralRe: I solved this problem. Pin
kwik220-Mar-06 0:37
memberkwik220-Mar-06 0:37 
GeneralPath not set Pin
Kannan Kalyanaraman17-Mar-02 2:32
memberKannan Kalyanaraman17-Mar-02 2:32 
GeneralI Have the same problem Pin
SMORGS26-Feb-03 12:17
memberSMORGS26-Feb-03 12:17 
GeneralRe: I Have the same problem Pin
Anonymous18-Mar-04 17:03
sussAnonymous18-Mar-04 17:03 
GeneralRe: I Have the same problem Pin
kindvibe328-Apr-04 13:11
memberkindvibe328-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.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160525.2 | Last Updated 6 Jul 2001
Article Copyright 2001 by Gaston
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid