Re: No access to AD through DirectoryEntry/Searcher even when logging on

From: Willy Denoyette [MVP] (willy.denoyette@pandora.be)
Date: 06/24/02


From: "Willy Denoyette [MVP]" <willy.denoyette@pandora.be>
Date: Mon, 24 Jun 2002 13:38:26 +0200


No, the explicit credentials are used when binding.

Use explicit credentials:
("LDAP://servername", "user", "password", AuthenticationTypes.ServerBind)

Following uses the default credentials (process or impersonation thread token):
("LDAP://servername", null, null, AuthenticationTypes.ServerBind)

Take also care of the following:
When specifying the usesername as something like : eTrond, then you need to specify secure binding (AuthenticationTypes.Secure).
Otherwise you can bind using:
- pre w2k "domain\user" syntax
- user@some.domain.com upn syntax.

without secure binding.

But I don't think this has something to do with your problem.
Did you try to use exactly the same binding string AND credentials AND AuthenticationTypes from a winforms/console application
Also check whether computer.company.no is a server name or a domain name, if not sure use the flat NetBIOS name of the AD/DC.
You may ask why this is important, well, when using a FQN, the LDAP provider will try to authenticate the credentials supplied using
Kerberos, when using the flat name NTLM will be used when binding.

Willy.

"Trond-Eirik" <tronderirikkolloen@hotmail.com> wrote in message news:e4JLrE2GCHA.2672@tkmsftngp13...
> Hello
>
> Thanks for your replay.
> I have tested this using the ServerBind flag as well.
> All the values should be correct, as I have tested the exact same values in
> a .Net windows application.
> The problems is only when I try do do this from the ASP.NET Web Application.
> From the .Net Windows application it works just fine.
>
> In my understanding this should indicate that all the connect paramters are
> correct.
>
> Here is my teory (problably wrong, but it at least a teory):
> - When impersonation is activated does ASP.NET override the login procedure
> and attemts to use the login of the impersonated user, and this is done
> after the authentication with the given input parameters.
> Since the impersonated user fails to connect due to the "impersonation does
> not work between servers problem" this causes the connection to not work.
>
> Any other good ideas?
>
> mvh, TEK
>
>
> "Willy Denoyette [MVP]" <willy.denoyette@pandora.be> wrote in message
> news:uVgqs#hGCHA.1292@tkmsftngp04...
> >
> > The error message means that or the server cannot be reached, or the LDAP
> service is not running.
> > Is this the fullu qualified server name or domain name?
> > computer.company.no
> >
> > If it's a sever name:
> > make sure the name can be resolved.
> > What you can do is to replace the name by it's IP address, or store
> the name in the etc\hosts file.
> > You also should add the serverbind flag ( see: AuthenticationTypes enum)
> >
> > Willy.
> >
> >
> >
> > "Trond-Eirik" <tronderirikkolloen@hotmail.com> wrote in message
> news:#XXjJbGGCHA.2880@tkmsftngp12...
> > > Hello
> > >
> > > I'm having a web application running in IIS and ASP.Net/C#
> > > The webserver is using "Integrated Windows authentication"
> > > It's not an option to use "Basic authentication"
> > >
> > > I'm using <identity impersonate="true"/> in the web.config file to be
> able
> > > to impersonate the users.
> > >
> > > From my app (a C# class) I need to connect to AD to retrive some
> > > information.
> > > The optional would be that I could use impersonation to identify the
> user,
> > > but due to the fact that IIS and impersonate does not work when
> accessing
> > > resources on external computers, I'm not able to do this.
> > >
> > > So, instead I'm trying to log on to AD using a dedicated user with
> enought
> > > access rights.
> > > But this throws an exception saying: "The server is not operational"
> > >
> > > I have tested my code in a windows form, and everything was working just
> > > wonderful.
> > > But in my ASP.NET Web Application, nothing is working...
> > >
> > > The gode is as follows:
> > >
> > > DirectoryEntry objRoot = new DirectoryEntry(LDAP://computer.company.no,
> > > "<username>", "<password>"); /*I have also tried difference
> > > AuthenticationTypes */
> > > DirectorySearcher objSearcher = new DirectorySearcher(objRoot);
> > > objSearcher.Filter = "(displayName=Trond*)"
> > > SearchResult objResult = objSearcher.FindOne(); // this fails
> > > if(objResult != null){
> > > //write success
> > > }
> > >
> > > The line
> > > SearchResult objResult = objSearcher.FindOne();
> > > throws an COM exception.
> > >
> > > Anyone have a solution for this?
> > >
> > > Best regards
> > > Trond-Eirik
> > >
> > >
> >
> >
>
>



Relevant Pages

  • RE: accessing WebService from asp.net App on load balanced Servers
    ... Would Constrained Delegation not give me a solution here? ... Original user impersonation will carry through to the back end server?? ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Directory.GetFiles() / DirectoryInfo.GetFiles() on a remote server
    ... Are you sure the user you're impersonating has permission to that server and file share? ... To rule out credential issues once and for all I think you should try impersonation using your user account since you know for sure that you have access. ... I get an access error message when the code is running on a asp.net app. ... First I thought it was just a matter of credentials, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: no Access to Client-Files with impersonate=true
    ... > credentials to ... when server has to access a network share for example. ... > impersonation, when accessing network shares. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Windows authentication for web service client??
    ... > Dim Response As System.Net.HttpWebResponse ... > make my http WEBDAV request here ... ... CredentialCache.DefaultCredentials will return the credentials that ... I have try the same approach using implicity impersonation, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Going from anonymous security to Windows Security in an ASP.NET application
    ... as I said in my previous post - there is no context on the client... ... Your page.context exists purely on the server. ... we need to have our own login page instead of the standard Windows logon ... impersonation, which takes place on the server has no effect on page ...
    (microsoft.public.dotnet.framework.aspnet.security)