Click here to Skip to main content
15,914,163 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adding a site to 'Trusted Sites' Zone Automatically Pin
Rocky Moore17-Mar-03 1:24
Rocky Moore17-Mar-03 1:24 
GeneralReading Microsoft IE Proxy Settings Pin
Vasudevan Deepak Kumar15-Mar-03 1:44
Vasudevan Deepak Kumar15-Mar-03 1:44 
GeneralRe: Reading Microsoft IE Proxy Settings Pin
Stephane Rodriguez.15-Mar-03 2:43
Stephane Rodriguez.15-Mar-03 2:43 
GeneralRe: Reading Microsoft IE Proxy Settings Pin
Thomas Freudenberg2-Jun-03 1:43
Thomas Freudenberg2-Jun-03 1:43 
GeneralC# DLL in VC++ Pin
Baatezu14-Mar-03 19:42
Baatezu14-Mar-03 19:42 
GeneralRe: C# DLL in VC++ Pin
Stephane Rodriguez.14-Mar-03 20:08
Stephane Rodriguez.14-Mar-03 20:08 
GeneralRunning .NET Application Pin
Sassan Komeili Zadeh14-Mar-03 19:29
Sassan Komeili Zadeh14-Mar-03 19:29 
GeneralActiveDirectory / LDAP Searching Pin
Adrian Hall14-Mar-03 19:07
Adrian Hall14-Mar-03 19:07 
I have a requirement to authenticate users against a non-MS LDAP service using non-standard attributes. The general method of doing this is to search for the user anonymously, then re-bind to the server with the found DN and the provided password.

I'm using the following code to implement the search, but it always fails (error provided below):

<br />
DirectoryEntry me;<br />
string filter = "(mailLocalAddress=" + uid + ")";<br />
string path = "ldap://10.10.240.19/o=Top";<br />
<br />
DirectoryEntry dbE = new DirectoryEntry(path);<br />
DirectorySearcher dsE = new DirectorySearcher(dbE, filter);<br />
dsE.SizeLimit = 2;<br />
SearchResultCollection src = dsE.FindAll();<br />
<br />
if (src.Count == 0) <br />
{<br />
	throw new AuthenticationException("Login Incorrect");<br />
}<br />
if (src.Count > 1)<br />
{<br />
	throw new AuthenticationException("Invalid LDAP Response");<br />
}<br />
me = src[0].GetDirectoryEntry(); <br />


The error I get is:

<br />
System.Runtime.InteropServices.COMException (0x80040E37): Unknown error (0x80040e37) at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at System.DirectoryServices.DirectoryEntry.get_AdsObject() at System.DirectoryServices.DirectorySearcher.FindAll(Boolean findMoreThanOne) at System.DirectoryServices.DirectorySearcher.FindAll() at Portal.Login.CheckPassword(String uid, String pass) in c:\inetpub\wwwroot\portal\login.aspx.cs:line 108<br />


Now, my base DN is indeed "top". What I am expecting is that the program binds anonymously to the specified LDAP server and does a sub-tree search on o=Top for my filter.

Anyone have any ideas?

-Adrian
GeneralRe: ActiveDirectory / LDAP Searching Pin
Adrian Hall16-Mar-03 14:31
Adrian Hall16-Mar-03 14:31 
GeneralA question about the ThreadPool class Pin
Marc Clifton14-Mar-03 13:47
mvaMarc Clifton14-Mar-03 13:47 
GeneralRe: A question about the ThreadPool class Pin
James T. Johnson14-Mar-03 17:54
James T. Johnson14-Mar-03 17:54 
GeneralRe: A question about the ThreadPool class Pin
Marc Clifton15-Mar-03 5:51
mvaMarc Clifton15-Mar-03 5:51 
GeneralRe: A question about the ThreadPool class Pin
leppie14-Mar-03 21:14
leppie14-Mar-03 21:14 
GeneralRe: A question about the ThreadPool class Pin
Marc Clifton15-Mar-03 5:57
mvaMarc Clifton15-Mar-03 5:57 
GeneralRe: A question about the ThreadPool class Pin
leppie15-Mar-03 7:23
leppie15-Mar-03 7:23 
GeneralRe: A question about the ThreadPool class Pin
Marc Clifton17-Mar-03 3:28
mvaMarc Clifton17-Mar-03 3:28 
GeneralRe: A question about the ThreadPool class Pin
Arun Bhalla17-Mar-03 16:55
Arun Bhalla17-Mar-03 16:55 
QuestionRelative and absolute path ? Pin
Chris Richner14-Mar-03 13:33
Chris Richner14-Mar-03 13:33 
AnswerRe: Relative and absolute path ? Pin
James T. Johnson14-Mar-03 17:46
James T. Johnson14-Mar-03 17:46 
GeneralRe: Relative and absolute path ? Pin
Chris Richner17-Mar-03 4:40
Chris Richner17-Mar-03 4:40 
GeneralRe: Relative and absolute path ? Pin
James T. Johnson17-Mar-03 15:02
James T. Johnson17-Mar-03 15:02 
GeneralRe: Relative and absolute path ? Pin
James T. Johnson17-Mar-03 16:33
James T. Johnson17-Mar-03 16:33 
GeneralRe: Relative and absolute path ? Pin
Chris Richner18-Mar-03 9:30
Chris Richner18-Mar-03 9:30 
Generalconvert bitmap to bytes[] !!! Pin
Dalia14-Mar-03 10:08
Dalia14-Mar-03 10:08 
GeneralRe: convert bitmap to bytes[] !!! Pin
Anonymous14-Mar-03 10:31
Anonymous14-Mar-03 10:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.