2012-03-28 1 views
0
내가 C# 및 ASP.Net 응용 프로그램 작업입니다

, 즉 그것은 잘 작동 http://msdn.microsoft.com/en-us/library/ms180890(v=vs.90).aspx웹 응용 프로그램에 LDAP에서 이메일을 당겨하는 방법

내가 여기 폼 인증을 ... 사용하지만 지금은 싶습니다 보라 링크 추가에 alittle 가서 또한 내가 검색 한

lblName.Text = "Hello " + Context.User.Identity.Name + "."; 
    lblAuthType.Text = "You were authenticated using " 
        + Context.User.Identity.AuthenticationType + "."; 

의 나머지 부분과 텍스트에 LDAP 및 파이프를에 메일 필드에서 이메일 주소를 끌어와 논문을 읽어 나는 다른 DirectorySearcher 쿼리처럼 LdapAuthentication.cs에 코드를 추가해야하지만, 내가해야합니까 말할 수있는 것과

How to get the current user's Active Directory details in C#

How to use email as httpcontext.User.Identity.name

http://www.codekeep.net/snippets/402e4677-f8d0-419c-b656-b3c28e740296.aspx

... 대답을 oking 완전히 새로운 검색을하거나 사용자 이름을 검색 할 때 쿼리에 추가 할 수 있습니까?

..I'm이 너무 새롭고 내가 열심히 노력하고있어하지만 난 .. 어떤 도움이 얻을 수 없습니다

  DirectorySearcher search = new DirectorySearcher(entry); 

      search.Filter = "(SAMAccountName=" + username + ")"; 
      search.PropertiesToLoad.Add("cn"); 
      search.PropertiesToLoad.Add("mail"); // e-mail address 
      SearchResult result = search.FindOne(); 

      if (null == result) 
      { 
       return false; 
      } 
처럼?

답변

0

PropertiesToLoad에 메일을 추가 한 다음 result (String) result.Properties [ "mail"] [0]에 액세스하여 결과를 얻을 수 있습니다. Properties는 2 차원 배열이며, 첫 번째 벡터는 속성 이름이고, 두 번째는 속성이 다중 변수 인 경우에 사용됩니다.

관련 문제