Solved

vb.net and ldap authentication

Posted on 2014-10-24
4
301 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 10

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Installing a printer using group policy preferences is not that hard let’s take a look at it. First lets open up your group policy console and edit the policy you want to add it to. I recommend creating a new policy for each printer makes it a l…
Synchronize a new Active Directory domain with an existing Office 365 tenant
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now