S
shadow.demon
Hi,
when i try to call
SearchResult res = srch.FindOne();
i get the following error:
Exception Details: System.Runtime.InteropServices.COMException: Unknown
error (0x80005000)
I have tried changed the connection string LDAP:// but nothing seems to
work. This code works fine from a windows based binary, with no
problems at all. Only when placed in a aspx page does it suddenly not
work. I've spend ages search google for anything, but there's not alot
of solutions. Any ideas? Thanks!!
<authentication mode="Windows"/>
<identity impersonate="true"/>
DirectoryEntry obEntry = new DirectoryEntry("LDAP://domain/");
DirectorySearcher srch = new DirectorySearcher(obEntry,
"(sAMAccountName=Administrator)");
//srch.Filter = "(cn=Users)";
SearchResult res = srch.FindOne();
if (null != res)
{
Html += res.Properties["givenName"][0].ToString() + " " +
res.Properties["sn"][0].ToString();
}
Stack trace:
[COMException (0x80005000): Unknown error (0x80005000)]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
+609
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +0
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.Bind() +0
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.DirectoryEntry.get_AdsObject() +0
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne) +73
System.DirectoryServices.DirectorySearcher.FindOne() +42
LoggedInUser.Page_Load(Object sender, EventArgs e) in
g:\Projects\IceSky V2.0\Controls\User\LoggedInUser.ascx.cs:33
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +36
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1064
when i try to call
SearchResult res = srch.FindOne();
i get the following error:
Exception Details: System.Runtime.InteropServices.COMException: Unknown
error (0x80005000)
I have tried changed the connection string LDAP:// but nothing seems to
work. This code works fine from a windows based binary, with no
problems at all. Only when placed in a aspx page does it suddenly not
work. I've spend ages search google for anything, but there's not alot
of solutions. Any ideas? Thanks!!
<authentication mode="Windows"/>
<identity impersonate="true"/>
DirectoryEntry obEntry = new DirectoryEntry("LDAP://domain/");
DirectorySearcher srch = new DirectorySearcher(obEntry,
"(sAMAccountName=Administrator)");
//srch.Filter = "(cn=Users)";
SearchResult res = srch.FindOne();
if (null != res)
{
Html += res.Properties["givenName"][0].ToString() + " " +
res.Properties["sn"][0].ToString();
}
Stack trace:
[COMException (0x80005000): Unknown error (0x80005000)]
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
+609
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +0
System.DirectoryServices.DirectoryEntry.Bind() +36
System.DirectoryServices.DirectoryEntry.Bind() +0
System.DirectoryServices.DirectoryEntry.get_AdsObject() +31
System.DirectoryServices.DirectoryEntry.get_AdsObject() +0
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne) +73
System.DirectoryServices.DirectorySearcher.FindOne() +42
LoggedInUser.Page_Load(Object sender, EventArgs e) in
g:\Projects\IceSky V2.0\Controls\User\LoggedInUser.ascx.cs:33
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +36
System.Web.UI.Control.OnLoad(EventArgs e) +102
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Control.LoadRecursive() +131
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1064