Ask a Question related to ASP.NET General, Design and Development.
-
Enosh Chang #1
DirectoryServices error!
Hi all,
I encounter some problem in DirectoryServices, could someone help me?
private void InitLoginUser()
{
DirectoryEntry objEntry = new DirectoryEntry();
DirectorySearcher objSearcher = new DirectorySearcher();
SearchResult objResult;
try
{
objEntry.Path = "LDAP://dc=iec,dc=inventec";
objSearcher.SearchRoot = objEntry;
objSearcher.Filter = "(sAMAccountName=*464*)";
objSearcher.SearchScope = SearchScope.Subtree;
objSearcher.PropertiesToLoad.Add("displayName");
objResult = objSearcher.FindOne();
} // try
finally
{
} // finally
}
private void Page_Load(object sender, System.EventArgs e)
{
// ±N¨Ï¥ÎªÌµ{¦¡½X¸m©ó¦¹¥Hªì©l¤Æºô*¶
if (!IsPostBack)
InitLoginUser();
}
But it always show error message as following:
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: The
specified domain either does not exist or could not be contacted
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 (0x8007054b): The specified domain either does not exist or
could not be contacted]
System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail) +514
System.DirectoryServices.DirectoryEntry.Bind() +10
System.DirectoryServices.DirectoryEntry.get_AdsObj ect() +10
System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne) +199
System.DirectoryServices.DirectorySearcher.FindOne () +31
MailTracking.WebForm1.InitLoginUser() in
c:\inetpub\wwwroot\mailtracking\default.aspx.cs:35
MailTracking.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\mailtracking\default.aspx.cs:46
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
Anyway, thanks all!
Enosh Chang Guest
-
Impersonation, DirectoryServices
Do you get an UnauthorizedAccessException from the InnerException from the TargetInvocationException that gets thrown or something else? ... -
DirectoryServices Namespace
Hi I am trying to import the System.DirectoryServices namespace in an aspx page with the following syntax <%@ Import... -
Sytem.DirectoryServices
Add an assembly reference to it first. Joe K. "prakash s via .NET 247" <anonymous@dotnet247.com> wrote in message... -
System.DirectoryServices
I have a few pages which authenticate a user to our site. Checking a login and password with syntax as below: Dim entry As New... -
ASP.NET + DirectoryServices
Hi all, Could I use DirectoryServices in ASP.NET? Or could you give sample code? Thanks! Best Regards Enosh Chang -
Natty Gur #2
Re: DirectoryServices error!
Hi,
you need to write the full domain name with DCs
For example if the domin name is microsoft.com it should be :
DC=microsoft,DC=com
Connect to computers in a domain. For example, "LDAP://CN=
computer-name, CN=Computers, DC= domain-controller1, DC=
domain-controller2,...".
Natty Gur, CTO
Dao2Com Ltd.
34th Elkalay st. Raanana
Israel , 43000
Phone Numbers:
Office: +972-(0)9-7740261
Fax: +972-(0)9-7740261
Mobile: +972-(0)58-888377
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest



Reply With Quote

