473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

IIS And DirectoryServices

Ram
Hey,
How can I bind a DirectoryEntry to a IIsWebDirectory?
I tried the following code:
DirectoryEntry entry = new
DirectoryEntry("IIS://localhost/w3svc/1/root/webdirectory");
But the schematype of this entry is - IISObject and because of that - I cant
use the IIsWebDirectory's methods i.e - AppCreate.
Is there a way to tell the directoryentry what type of object this entry
represents?
Thanks ahead

--Ram


Nov 16 '05 #1
3 5484
Where did you get this from, IISObject is a WMI type ?

Please post your whole code.

Willy.

"Ram" <ni***@bezeqint.net> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
Hey,
How can I bind a DirectoryEntry to a IIsWebDirectory?
I tried the following code:
DirectoryEntry entry = new
DirectoryEntry("IIS://localhost/w3svc/1/root/webdirectory");
But the schematype of this entry is - IISObject and because of that - I
cant
use the IIsWebDirectory's methods i.e - AppCreate.
Is there a way to tell the directoryentry what type of object this entry
represents?
Thanks ahead

--Ram

Nov 16 '05 #2
Ram
Here's my code:
DirectoryEntry webEntry;
webEntry = new DirectoryEntry("IIS://localhost/w3svc/1/ROOT/newWebDir");
//Now, if I look in the locals window, the webEntry's SchemaClassName is -
"IISObject" where it should be IIsWebDirectory
webEntry.Invok("AppCreate",new object[]{true}); //This line gives me the
error since the entry is not of type - IIsWebDirectory...
webEntry.CommitChanges();
Thanks again,

--Ram
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:O#**************@TK2MSFTNGP15.phx.gbl...
Where did you get this from, IISObject is a WMI type ?

Please post your whole code.

Willy.

"Ram" <ni***@bezeqint.net> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
Hey,
How can I bind a DirectoryEntry to a IIsWebDirectory?
I tried the following code:
DirectoryEntry entry = new
DirectoryEntry("IIS://localhost/w3svc/1/root/webdirectory");
But the schematype of this entry is - IISObject and because of that - I
cant
use the IIsWebDirectory's methods i.e - AppCreate.
Is there a way to tell the directoryentry what type of object this entry
represents?
Thanks ahead

--Ram


Nov 16 '05 #3

"Ram" <ni***@bezeqint.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Here's my code:
DirectoryEntry webEntry;
webEntry = new DirectoryEntry("IIS://localhost/w3svc/1/ROOT/newWebDir");
//Now, if I look in the locals window, the webEntry's SchemaClassName is -
"IISObject" where it should be IIsWebDirectory
webEntry.Invok("AppCreate",new object[]{true}); //This line gives me
the
error since the entry is not of type - IIsWebDirectory...
webEntry.CommitChanges();
Thanks again,

Suspposed your "newWebDir" physical directory exists in your root path.
You must add the directory to the metabase as a IISWibDirectory using :

rootEntry.Children.Add("newWebDir","IIsWebDirector y");

Here is a complete sample that illustrates the creation of a WebDirectory
and an application associated with this one.

// Some required const definitions
// Authorization flags
const int MD_AUTH_ANONYMOUS = 0x00000001; //Anonymous authentication
available.
const int MD_AUTH_BASIC = 0x00000002; //Basic authentication available.
const int MD_AUTH_NT = 0x00000004; //Windows authentication schemes
available.
// Browse flags
const int MD_DIRBROW_SHOW_DATE = 0x00000002; //Show date.
const int MD_DIRBROW_SHOW_TIME = 0x00000004; // Show time.
const int MD_DIRBROW_SHOW_SIZE = 0x00000008; //Show file size.
const int MD_DIRBROW_SHOW_EXTENSION = 0x00000010; //Show file name
extension.
const int MD_DIRBROW_LONG_DATE = 0x00000020; //Show full date.
const int MD_DIRBROW_LOADDEFAULT = 0x40000000; // Load default page, if it
exists.
const uint MD_DIRBROW_ENABLED = 0x80000000;
// Access Flags
const int MD_ACCESS_READ = 0x00000001; //Allow read access.
const int MD_ACCESS_WRITE = 0x00000002; //Allow write access.
const int MD_ACCESS_EXECUTE = 0x00000004; //Allow file execution
(includes script permission).
const int MD_ACCESS_SOURCE = 0x00000010; //Allow source access.
const int MD_ACCESS_SCRIPT = 0x00000200; // Allow script execution.
const int MD_ACCESS_NO_REMOTE_WRITE = 0x00000400; // Local write access
only.
const int MD_ACCESS_NO_REMOTE_READ = 0x00001000; // Local read access
only.
const int MD_ACCESS_NO_REMOTE_EXECUTE = 0x00002000; // Local execution
only.

....

DirectoryEntry folderRoot = new
DirectoryEntry(("IIS://localhost/w3svc/1/ROOT", "administrator", "adminpwd",
AuthenticationTypes.Secure);
folderRoot.RefreshCache();
// Add the WebDirectory to the metabase
DirectoryEntry dir =
folderRoot.Children.Add("newWebDir","IIsWebDirecto ry");
dir.CommitChanges();

// Set some Properties
dir.Properties["AuthFlags"].Value = MD_AUTH_ANONYMOUS |
MD_AUTH_NT;
dir.Properties["DefaultDoc"].Value = "default.aspx";
dir.Properties["DirBrowseFlags"].Value = MD_DIRBROW_SHOW_DATE |
MD_DIRBROW_ENABLED |
MD_DIRBROW_SHOW_SIZE | MD_DIRBROW_SHOW_EXTENSION |
MD_DIRBROW_LONG_DATE | MD_DIRBROW_LOADDEFAULT;
dir.Properties["AccessFlags"].Value = MD_ACCESS_READ |
MD_ACCESS_SCRIPT;

// Call AppCreat2 to create a Web application (0 =In-proc, 1 =
Out-proc, 2 = Pooled) , not needed for ASP.NET
object[] applicationType = new object[]{0};
dir.Invoke("AppCreate2", applicationType);
// Save Changes
dir.CommitChanges();
folderRoot.CommitChanges();
dir.Close();
folderRoot.Close();

Willy.
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: kovac | last post by:
The System.directoryservices.dll has an error, and this error was described in http://support.microsoft.com/default.aspx?scid=kb;en-us;839424 At the moment we have Framework version v1.0.3705 and...
12
by: hykim | last post by:
Hello, everyone. according to MSDN, there is any constructor of System.DirectoryServices.SearchResultCollection Class. if I implement DirectorySearcher.FindAll() method by myself, then how can I...
1
by: Jason Gleason | last post by:
I am using the following method in a web service that utilizes the system.directoryservices namespace: public ArrayList GetAllAppPools(){ System.DirectoryServices.DirectoryEntry apppools = new...
1
by: Enosh Chang | last post by:
Hi all, I encounter some problem in DirectoryServices, could someone help me? private void InitLoginUser() { DirectoryEntry objEntry = new DirectoryEntry(); DirectorySearcher objSearcher =...
0
by: Chris Frohlich | last post by:
All, I've built an Employee Directory with ASP.NET app that queries Active Directory for users and builds links with the results. What I'm seeing is really intermittent failures to bind to the...
9
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
2
by: Kelvin | last post by:
Hello I am using web matrix develop a login page through Active Directory but I cannot figure out why it is giving me an error when importing system.directoryServices. Any help will do! thank ...
5
by: Keith Jakobs, MCP | last post by:
Hi All.... I'm having a HECK of a time connecting to Active Directory using VB in Visual Studio.NET 2003. Can anyone PLEASE help me? All I am trying to do is list the current members of our...
7
by: turbon | last post by:
Hello, I am writing code, which will copy webServices from one IIS 6.0 webserver to another and using DirentoryServices to achieve this purpose. And I have problems with authentication - I get an...
7
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.