|
-
May 30th, 2007, 12:22 AM
#1
Thread Starter
Member
how to retrieve active directory objects
Hi,
I want to develop an application in which I can use active directory objects. How can I retrieve user name, password and Domain from the active directory? I want to log on my software using the active directory user name and password.
I am using .NET 2003 and framework 1.1 .
Thanking you,
Zahir
-
May 30th, 2007, 07:35 AM
#2
Re: how to retrieve active directory objects
You would use classes in System.DirectoryServices to interact with your AD...
Sample code can be found here
http://www.c-sharpcorner.com/UploadF...Directory.aspx
-
May 30th, 2007, 11:30 AM
#3
Re: how to retrieve active directory objects
 Originally Posted by zisohel
Hi,
I want to develop an application in which I can use active directory objects. How can I retrieve user name, password and Domain from the active directory? I want to log on my software using the active directory user name and password.
I am using .NET 2003 and framework 1.1 .
Thanking you,
Zahir
Then just set Windows Authentication in IIS for your application. You don't need to go diving into AD>
-
Jun 3rd, 2007, 03:49 AM
#4
Thread Starter
Member
Re: how to retrieve active directory objects
Dear Mendhak,
Thanks for your reply. How can I retrieve user name and password from Windows Authentication.
-
Jun 3rd, 2007, 11:03 AM
#5
Re: how to retrieve active directory objects
You can only get the username - you will never be able to retrieve the password unless you're using forms authentication. Which you're not :P
As for retrieving the Windows username:
1) Ensure that the <identity> element in your web.config has the attribute "impersonate" set to "true" (i.e. <identity impersonate="true" />). See the MSDN documentation for more information.
2) Ensure that anonymous access is disabled in IIS.
3) The fully qualified username is available in the System.Web.HttpContext.Current.User.Identity.Name property.
-
Jun 4th, 2007, 02:47 AM
#6
Thread Starter
Member
Re: how to retrieve active directory objects
Thanks axion_sa it works. You said unless using the form authentication I can't retrieve the password. How can I retrieve the password from the Form authentication? I want to verrify the user name and password from the active directory.
-
Jun 4th, 2007, 10:46 AM
#7
Re: how to retrieve active directory objects
If your code is running, IIS has already authenticated the user - which is the point of integrated/Windows authentication; you don't need to worry about credential storage nor authentication mechanisms. For all intents & purposes, "it just happens" - it's a lovely little blackbox.
Simply put - you do not need the user's password.
-
Jun 4th, 2007, 03:59 PM
#8
Re: how to retrieve active directory objects
For the purpose of storing in your session variable, if you need that for other parts of your application, use User.Identity.Name.
-
Jun 5th, 2007, 01:47 AM
#9
Re: how to retrieve active directory objects
 Originally Posted by mendhak
For the purpose of storing in your session variable, if you need that for other parts of your application, use User.Identity.Name.
Erm... point 3 above
-
Jun 5th, 2007, 02:02 PM
#10
Re: how to retrieve active directory objects
The naming convention you used was so long I fell asleep halfway through reading it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|