Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > How to get LDAP directory server

Reply
Thread Tools

How to get LDAP directory server

 
 
VK
Guest
Posts: n/a
 
      05-26-2005
Hello,

We have installed AD and now I want to authenticate the user against AD via
IIS and get the user information via LDAP. However I dont know the LDAP
Directory. How do I get the LDAP directory?

Thanks
 
Reply With Quote
 
 
 
 
Jan Peter Stotz
Guest
Posts: n/a
 
      05-27-2005
VK schrieb:

> We have installed AD and now I want to authenticate the user against AD via
> IIS and get the user information via LDAP. However I dont know the LDAP
> Directory. How do I get the LDAP directory?


You can use this function:

Function GetADsDomainName as String
dim objRootDSE
objRootDSE = GetObject("LDAP://rootDSE")
return objRootDSE.Get("DefaultNamingContext")
End Function

It returns the LDAP-path of your ActiveDirectory:

For Example "dc=yourdomain,dc=com".

Jan
 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      05-27-2005
I tried that and get:

Cannot create ActiveX component.

Private Function GetLDAPEntry() As DirectoryEntry
Dim objRootDSE
objRootDSE = GetObject("LDAP://rootDSE") <-- Error here
Return New
DirectoryEntry(objRootDSE.Get("DefaultNamingContex t")) End Function



"Jan Peter Stotz" wrote:

> VK schrieb:
>
> > We have installed AD and now I want to authenticate the user against AD via
> > IIS and get the user information via LDAP. However I dont know the LDAP
> > Directory. How do I get the LDAP directory?

>
> You can use this function:
>
> Function GetADsDomainName as String
> dim objRootDSE
> objRootDSE = GetObject("LDAP://rootDSE")
> return objRootDSE.Get("DefaultNamingContext")
> End Function
>
> It returns the LDAP-path of your ActiveDirectory:
>
> For Example "dc=yourdomain,dc=com".
>
> Jan
>

 
Reply With Quote
 
Joe Kaplan \(MVP - ADSI\)
Guest
Posts: n/a
 
      05-27-2005
In an ASP.NET application, you may need to supply a domain name in your
binding string and some valid credentials in the username and password
parameters. The issue is that in ASP.NET, it is often the case that you are
running under a local machine account whose credentials cannot be used to
access AD directly.

Essentially, what you will want to do is read the Context.User.Identity.Name
property in ASP.NET to get the current user name (will be domain\username),
then pull off the username part and use that in a search filter to search
the domain for that user. The filter would look like
(sAMAccountName=username)

Using PropertiesToLoad on the DirectorySearcher, you can specify which AD
attributes you wish to retrieve and get them back in a SearchResult object.

Depending on the structure of your AD, you may want to search at the domain
level or do a global catalog search at the forest level
(GC://domain.com/xxxxx), depending on whether multiple domains are involved.

HTH,

Joe K.

"VK" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I tried that and get:
>
> Cannot create ActiveX component.
>
> Private Function GetLDAPEntry() As DirectoryEntry
> Dim objRootDSE
> objRootDSE = GetObject("LDAP://rootDSE") <-- Error here
> Return New
> DirectoryEntry(objRootDSE.Get("DefaultNamingContex t")) End Function
>
>
>
> "Jan Peter Stotz" wrote:
>
>> VK schrieb:
>>
>> > We have installed AD and now I want to authenticate the user against AD
>> > via
>> > IIS and get the user information via LDAP. However I dont know the LDAP
>> > Directory. How do I get the LDAP directory?

>>
>> You can use this function:
>>
>> Function GetADsDomainName as String
>> dim objRootDSE
>> objRootDSE = GetObject("LDAP://rootDSE")
>> return objRootDSE.Get("DefaultNamingContext")
>> End Function
>>
>> It returns the LDAP-path of your ActiveDirectory:
>>
>> For Example "dc=yourdomain,dc=com".
>>
>> Jan
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
python-ldap/win32 or python/ldap/win32 rcmn Python 1 11-06-2006 11:47 PM
Need to wrtie LDAP class to *answer* LDAP queries. junk1@davidbevan.co.uk Java 1 02-21-2006 09:59 PM
[ANN] Ruby/LDAP 0.9.1: LDAP API (RFC1823) library. Ian Macdonald Ruby 0 03-15-2005 11:23 PM
using LDAP Controls in ruby-ldap Jason Wold Ruby 5 11-07-2004 03:35 AM



Advertisments