.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

hurry! some quesstion about AD ,thx

Posted By:      Posted Date: October 18, 2010    Points: 0   Category :ASP.Net

hi !

  I need to Login to a AD , and  there are to DC ,  now I can get a  right resut use these above code :

 private bool IsAuthenticated(String username, String pwd)

      String server = ConfigurationManager.AppSettings["ADServer"];//
      String path = ConfigurationManager.AppSettings["ADPath"];//smallbusiness.com
      String domainAndUsername = username;
      DirectoryEntry entry;
      entry = new DirectoryEntry(@"LDAP://" + server ,"DC=smallbusiness,DC=com,"+"cn="+ domainAndUsername, pwd, AuthenticationTypes.Secure);
          Object obj = entry.NativeObject;
          DirectorySearcher search = new DirectorySearcher(entry);
          search.Filter = "(SAMAccountName=" + username + ")";
          SearchResult result = search.FindOne();
          if (result == null)
              return false;
          return true;
      catch (Exception ex)
          throw new Exception(ex.Message);
          return false;

but I dont know how to use the DC 'smallbusiness.com' to Check Account, now , I can get a right result without the DC, how to do it?

and ,I u

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend