.NETGURU
User mapping
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-adsi' list.


Tim Broome
Hi

Essentially I am working on an intranet and want to be able to access user
information without requiring the user to enter their username and password.
What I'm trying to do is map an nt user to their active directory account
from asp.net. As I don't have the full LDAP path for use with the
directoryservices.directoryentry I don't really know how to do it. It seems
a fairly fundamental thing so fear I've missed something obvious but haven't
found any demo code that doesn't require a username/password to get
anywhere.

Thanks for any help

Tim

Reply to this message...
 
    
Davis, Joe
Here's some sample code I put together to check nt account information and
it takes a simple change to have it check exchange data.
Be sure to add the System.DirectoryServices to the references list and of
course add it to your using declaration.
Also be sure to add System.Runtime.InteropServices

    DirectoryEntry objDE = new
DirectoryEntry("WinNT://adsisvr.mydomain.com/mylogon");

    // LIST THE CHILDREN VALUES
    Response.Write("<h3>Children</h3>");

        foreach(DirectoryEntry objChildDE in objDE.Children)
            Response.Write(objChildDE.Path+"<BR>");
    
    // LIST THE PROPERTY VALUES
    System.DirectoryServices.PropertyCollection properties =
objDE.Properties;
    Response.Write("<h3>Properties</h3>");

        foreach(string propName in properties.PropertyNames)
        {
            PropertyValueCollection values =
properties[propName];
            foreach (object val in values)
                Response.Write("<b>"+propName+":</b>
"+val.ToString()+"<BR>");
        }

-----Original Message-----
From: Tim Broome [mailto:Click here to reveal e-mail address]
Sent: Monday, August 05, 2002 5:56 AM
To: ngfx-adsi
Subject: [ngfx-adsi] User mapping

Hi

Essentially I am working on an intranet and want to be able to access user
information without requiring the user to enter their username and password.
What I'm trying to do is map an nt user to their active directory account
from asp.net. As I don't have the full LDAP path for use with the
directoryservices.directoryentry I don't really know how to do it. It seems
a fairly fundamental thing so fear I've missed something obvious but haven't
found any demo code that doesn't require a username/password to get
anywhere.

Thanks for any help

Tim

| [ngfx-adsi] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-adsi.asp = JOIN/QUIT

Reply to this message...
 
    
Harout Katrjian
one way to do is to use the DirectorySearcher object and go hunting for the
user but that does not guaranty one to one mapping.

let me know your end up doing

----- Original Message -----
From: "Tim Broome" <Click here to reveal e-mail address>
To: "ngfx-adsi" <Click here to reveal e-mail address>
Sent: Monday, August 05, 2002 5:56 AM
Subject: [ngfx-adsi] User mapping

[Original message clipped]

Reply to this message...
 
    
Eric Soonius
Tim,

I have some VB.NET code that retrieves the SAMaccount of an
authenticated user and uses that info to query the AD for more info for
example the Display Name. Is that what you are looking for?

Eric

[Original message clipped]

Reply to this message...
 
 
System.DirectoryServices.DirectoryEntry
System.DirectoryServices.DirectorySearcher
System.DirectoryServices.PropertyCollection
System.DirectoryServices.PropertyValueCollection




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification