Solved

vb.net and ldap authentication

Posted on 2014-10-24
4
346 Views
Last Modified: 2014-10-25
I currently have a program that queries ldap.  I need to be able to change it over to multiple domains.  I use the below for authentication.  How can i default the username and password to be the current logged in credentials cache?

Dim de As New DirectoryEntry("LDAP://bkng.net:389/DC=bkng,DC=net")
            de.Username = "johndoe"
            de.Password = "password"

Open in new window


How do i use CredentialCache.DefaultCredentials???
0
Comment
Question by:derek7467
4 Comments
 
LVL 11

Expert Comment

by:Ganesh Kumar A
ID: 40403534
Probably this microsoft article helps you to use AD authentication in vb.net.

http://support.microsoft.com/kb/326340 

or

Read this will help with your question : http://support.microsoft.com/kb/813834

Reference :
Here is the actual credentialcache.defaultcredentails usage from MSDN library :
http://msdn.microsoft.com/en-us/library/system.net.credentialcache.defaultcredentials(v=vs.110).aspx?cs-save-lang=1&cs-lang=vb#code-snippet-1
0
 
LVL 70

Accepted Solution

by:
Chris Dent earned 500 total points
ID: 40403652
If you wish to use current credentials simply don't bother supplying credentials at all (it will default to binding with the current users credentials).

i.e.
Dim de as New DirectoryEntry("LDAP://bkng")

Open in new window

Or, better still, use serverless binding:
Dim de as New DirectoryEntry()

Open in new window

Chris
0
 

Author Closing Comment

by:derek7467
ID: 40404190
didn't realize I was doing this now and could just addin another form for secondary login information if  needed.  Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article runs through the process of deploying a single EXE application selectively to a group of user.
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question