ASP.net: problem getting DirectoryEntry

ASP.net: problem getting DirectoryEntry

Post by Markus Stehl » Fri, 20 Dec 2002 03:12:17



Hi all!

In one of my asp.net pages I'd like to access an OU and add oder modify some
users. I'm creating a DirectoryEntry object as follows:
DirectoryEntry AD = new DirectoryEntry(LDAP://ou=MyOU,dc=myDomain,dc=net);

If I have a look at the variable 'AD' in my de* I can see that its
properties are not filled which means that there was an error. If I use the
same line of code within a C# console application it works without problems.
So what might be the problem in asp.net?
Thanks in advance

Markus

 
 
 

ASP.net: problem getting DirectoryEntry

Post by Joe Kapla » Fri, 20 Dec 2002 03:34:43


It is probably an authentication or serverless binding issue.  The thing to
realize is that ASP.NET by default runs under a local machine account,
ASPNET, which is not a domain member.  Therefore, you may not be able to do
a serverless bind or not provide credentials.  Using impersonation may help
with this, but in general it is safer supply server names and credentials
when working with DirectoryServices under ASP.NET.

Joe K.


Quote:> Hi all!

> In one of my asp.net pages I'd like to access an OU and add oder modify
some
> users. I'm creating a DirectoryEntry object as follows:
> DirectoryEntry AD = new DirectoryEntry(LDAP://ou=MyOU,dc=myDomain,dc=net);

> If I have a look at the variable 'AD' in my de* I can see that its
> properties are not filled which means that there was an error. If I use
the
> same line of code within a C# console application it works without
problems.
> So what might be the problem in asp.net?
> Thanks in advance

> Markus


 
 
 

ASP.net: problem getting DirectoryEntry

Post by Markus Stehl » Fri, 20 Dec 2002 18:42:08


Hi Joe!

Thanks for the reply. I've tried it again using automatic impersonation as
suggested and now it works perfectly. You said it may be unsfae to do it
this way - what exactly might be unsafe and how can I avoid this problem?

Markus


> It is probably an authentication or serverless binding issue.  The thing
to
> realize is that ASP.NET by default runs under a local machine account,
> ASPNET, which is not a domain member.  Therefore, you may not be able to
do
> a serverless bind or not provide credentials.  Using impersonation may
help
> with this, but in general it is safer supply server names and credentials
> when working with DirectoryServices under ASP.NET.

> Joe K.



> > Hi all!

> > In one of my asp.net pages I'd like to access an OU and add oder modify
> some
> > users. I'm creating a DirectoryEntry object as follows:
> > DirectoryEntry AD = new

DirectoryEntry(LDAP://ou=MyOU,dc=myDomain,dc=net);

- Show quoted text -

Quote:

> > If I have a look at the variable 'AD' in my de* I can see that its
> > properties are not filled which means that there was an error. If I use
> the
> > same line of code within a C# console application it works without
> problems.
> > So what might be the problem in asp.net?
> > Thanks in advance

> > Markus

 
 
 

ASP.net: problem getting DirectoryEntry

Post by Joe Kapla » Sat, 21 Dec 2002 01:04:11


I've been having problems with impersonation and getting anonymous binds
instead of authenticated binds.  For me, this makes it difficult to do
writes to the directory.  I am working with MS offline to resolve my issue.
However, you may not have this problem.  I just wanted to let you know that
there may be problems in some cases.

Joe K.


> Hi Joe!

> Thanks for the reply. I've tried it again using automatic impersonation as
> suggested and now it works perfectly. You said it may be unsfae to do it
> this way - what exactly might be unsafe and how can I avoid this problem?

> Markus



> > It is probably an authentication or serverless binding issue.  The thing
> to
> > realize is that ASP.NET by default runs under a local machine account,
> > ASPNET, which is not a domain member.  Therefore, you may not be able to
> do
> > a serverless bind or not provide credentials.  Using impersonation may
> help
> > with this, but in general it is safer supply server names and
credentials
> > when working with DirectoryServices under ASP.NET.

> > Joe K.

 
 
 

1. Problem with DirectoryEntry.MoveTo in ASP.NET...

Hi all!

I'm trying to move a user from one OU to another OU... I'm trying to use the
System.DirectoryEntry.MoveTo to do this but I keep on getting a
ArgumentNullException, even though the user gets moved from the first OU to
the second.

I skip sending the code at this moment and wonder if anyone has used this
method and has gotten it to work, and in that case how????

Best regards
Martin Emanuelsson
Gothenburg, Sweden

2. Debugging a CW plugin

3. DirectoryEntry properties in ASP.NET

4. SBS Admin Console

5. Getting ADSI to work in ASP.NET

6. PCMCIA Socket controller for MC68k

7. ADSI in ASP and ASP.NET problem

8. PS Level 3 for LJ6MP

9. set password using asp.net w/ vb.net?

10. asp.net: problem accessing active directory

11. Sharepoint Architects / Developers - C#, ASP.NET

12. error message with beta 2 ASP.NET ??

13. Running ASP.NET apps on SPS v1 -- where to store them ??