Solved

vb.net and ldap authentication

Posted on 2014-10-24
4
380 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 12

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 71

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 learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

In-place Upgrading Dirsync to Azure AD Connect
This article shows the method of using the Resultant Set of Policy Tool to locate Group Policy that applies a particular setting.
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

737 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