By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,385 Members | 847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,385 IT Pros & Developers. It's quick & easy.

System.Runtime.InteropServices.COMException (0x8007052E): Logon failure: unknown user

P: 1
Hi,
Im using the following code to retrieve the user details from the AD server. But when i execute the code,it throws me the error. Please help me in this regards."System.Runtime.InteropServices.COMException (0x8007052E): Logon failure: unknown user name or bad password. at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObj ect() at System.DirectoryServices.DirectorySearcher.FindAll (Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindOne () at _Default.Button1_Click(Object sender, EventArgs e) in D:\workfolder\test\Default.aspx.vb:line 24 " The code im using is:

Try

Dim _groot As DirectoryEntry
Dim _gSearchResult As System.DirectoryServices.SearchResult
Dim _gDirectorySearcher As DirectorySearcher
Dim sPath As String
sPath = "LDAP://111.122.188.15:389"
_groot = New DirectoryEntry(sPath)
_gDirectorySearcher = New DirectorySearcher(_groot)
_gDirectorySearcher.Filter = ("(&(objectClass='*')(cn= '372810'))")
_gSearchResult = _gDirectorySearcher.FindOne
If _gSearchResult Is Nothing Then
Else
Label1.Text = _gSearchResult.Properties("mail")(0)
End If

Catch ex As Exception
Response.Write(ex.ToString)
End Try
Feb 19 '07 #1
Share this Question
Share on Google+
1 Reply


kenobewan
Expert 2.5K+
P: 4,871
Where do you use a username & password. Here is an example that may help:
Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication
Feb 19 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.