Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 31st, 2006, 12:59 AM
Registered User
 
Join Date: May 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to take User's Full Name from Active Directory

hi friends,

     I am having one problem regarding accessing ActiveDirectory. My requirement is need to display the user name which is available in Activedirectory in the top of the webpage which a application(TimeTracker) we are using in intranet. I search the net and found some codings, they provide for console application and I created a console application and applied the codings, it is working fine all the way. I used the same coding in webapplication but it is not working. Can u able to tell me , why the problem is and can u able to help me to get out of this.

Note: i am using windows authentication.

The following is the code I used in the Page_Load event



DirectoryEntry entry = new DirectoryEntry("LDAP://ECWEB.local");

DirectorySearcher dSearch = new DirectorySearcher(entry);

String Name="krishnaprabhu";// name

dSearch.Filter = "(&(objectClass=user)(givenName=" + Name + "))";





foreach(SearchResult sResultSet in dSearch.FindAll())

{



// Login Name

Response.Write(GetProperty(sResultSet,"cn"));

// First Name

Response.Write(GetProperty(sResultSet,"givenName") );

// Middle Initials

Response.Write(GetProperty(sResultSet,"initials")) ;

// Last Name

Response.Write(GetProperty(sResultSet,"sn"));

// Address

string tempAddress=GetProperty(sResultSet,"homePostalAddr ess");

}








Similar Threads
Thread Thread Starter Forum Replies Last Post
how to take User's Full Name from Active Directory krisshnaprabhu ASP.NET 1.0 and 1.1 Professional 0 May 31st, 2006 12:56 AM
Finding user's home directory path bluckcuck Excel VBA 3 July 18th, 2005 09:23 AM
About Active Directory apalmero VB How-To 1 April 8th, 2005 04:06 PM
About Active Directory apalmero VS.NET 2002/2003 1 November 9th, 2003 01:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.