Query AD using Integrated Authentication?
From: Dave (Dave_at_discussions.microsoft.com)
Date: 07/27/04
- Next message: Mike Moore: "Compare user entered password with AD"
- Previous message: Raterus: "Re: accessing mapped drives in ASP.NET application"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Query AD using Integrated Authentication?"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Query AD using Integrated Authentication?"
- Reply: HG: "Re: Query AD using Integrated Authentication?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 27 Jul 2004 10:08:38 -0700
Hi,
I want to query AD for user's information once they are logged in.
Under Basic authentication, this worked fine using the code below.
However, when I switched to Integrated for an intranet site, the FindOne() bombs with "Logon failure: unknown user name or bad password". I don't know how to pass the username/password information while using Integrated Security. Is there a way to do this?
System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry("GC://mycompanydomain.com", HttpContext.Current.Request.ServerVariables["AUTH_USER"], HttpContext.Current.Request.ServerVariables["AUTH_PASSWORD"]);
System.DirectoryServices.DirectorySearcher search = new System.DirectoryServices.DirectorySearcher(entry);
search.Filter = "(sAMAccountName=" + sSAMAccountName + ")";
search.PropertiesToLoad.Add("sAMAccountName");
search.PropertiesToLoad.Add("cn");
search.PropertiesToLoad.Add("givenName");
search.PropertiesToLoad.Add("sn");
search.PropertiesToLoad.Add("mail");
search.PropertiesToLoad.Add("telephoneNumber");
System.DirectoryServices.SearchResult result = search.FindOne();
- Next message: Mike Moore: "Compare user entered password with AD"
- Previous message: Raterus: "Re: accessing mapped drives in ASP.NET application"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: Query AD using Integrated Authentication?"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: Query AD using Integrated Authentication?"
- Reply: HG: "Re: Query AD using Integrated Authentication?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]