Hi I've been having all kinds of headaches with this. I create a
DirectoryEntry object to try and access an LDAP database but I can't do
anything with the object all I get is a very non-helpful error message.
Example the following code doesn't work when tied into asp via codebehind.
namespace ReadLogonCB2
{
using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.DirectoryServices;
public class CodeBehind : System.Web.UI.Page
{
private void Page_Init(Object source, EventArgs e)
{ accessLDAP();
}
private void accessLDAP()
{ string resultString;
string connect;
connet = "LDAP://pdc:389/CN=Users,DC=sandvine,DC=com";
DirectoryEntry entry=new DirectoryEntry(connect);
resultString = entry.Name;
}
}//class
}//namespace
I get the following error from ASP:
Exception Details: System.Runtime.InteropServices.COMException: Unknown
error (0x80005000)
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[COMException (0x80005000): Unknown error (0x80005000)]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_Name() +10
ReadLogonCB2.CodeBehind.Page_Init(Object source, EventArgs e) +36
System.Web.UI.Control.OnInit(EventArgs e) +67
System.Web.UI.Control.InitRecursive(Control namingContainer) +235
System.Web.UI.Page.ProcessRequestMain() +171
Don't know if it's a problem with the connection string i'm using or could
it be a problem with the webserver configuration
please help
Greg