Hi all,
I encounter some problem in DirectoryServic es, could someone help me?
private void InitLoginUser()
{
DirectoryEntry objEntry = new DirectoryEntry( );
DirectorySearch er objSearcher = new DirectorySearch er();
SearchResult objResult;
try
{
objEntry.Path = "LDAP://dc=iec,dc=inven tec";
objSearcher.Sea rchRoot = objEntry;
objSearcher.Fil ter = "(sAMAccountNam e=*464*)";
objSearcher.Sea rchScope = SearchScope.Sub tree;
objSearcher.Pro pertiesToLoad.A dd("displayName ");
objResult = objSearcher.Fin dOne();
} // try
finally
{
} // finally
}
private void Page_Load(objec t sender, System.EventArg s 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.Director yServices.Direc toryEntry.Bind( Boolean throwIfFail) +514
System.Director yServices.Direc toryEntry.Bind( ) +10
System.Director yServices.Direc toryEntry.get_A dsObject() +10
System.Director yServices.Direc torySearcher.Fi ndAll(Boolean
findMoreThanOne ) +199
System.Director yServices.Direc torySearcher.Fi ndOne() +31
MailTracking.We bForm1.InitLogi nUser() in
c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:35
MailTracking.We bForm1.Page_Loa d(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:46
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +29
System.Web.UI.P age.ProcessRequ estMain() +724
Anyway, thanks all!
I encounter some problem in DirectoryServic es, could someone help me?
private void InitLoginUser()
{
DirectoryEntry objEntry = new DirectoryEntry( );
DirectorySearch er objSearcher = new DirectorySearch er();
SearchResult objResult;
try
{
objEntry.Path = "LDAP://dc=iec,dc=inven tec";
objSearcher.Sea rchRoot = objEntry;
objSearcher.Fil ter = "(sAMAccountNam e=*464*)";
objSearcher.Sea rchScope = SearchScope.Sub tree;
objSearcher.Pro pertiesToLoad.A dd("displayName ");
objResult = objSearcher.Fin dOne();
} // try
finally
{
} // finally
}
private void Page_Load(objec t sender, System.EventArg s 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.Director yServices.Direc toryEntry.Bind( Boolean throwIfFail) +514
System.Director yServices.Direc toryEntry.Bind( ) +10
System.Director yServices.Direc toryEntry.get_A dsObject() +10
System.Director yServices.Direc torySearcher.Fi ndAll(Boolean
findMoreThanOne ) +199
System.Director yServices.Direc torySearcher.Fi ndOne() +31
MailTracking.We bForm1.InitLogi nUser() in
c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:35
MailTracking.We bForm1.Page_Loa d(Object sender, EventArgs e) in
c:\inetpub\wwwr oot\mailtrackin g\default.aspx. cs:46
System.Web.UI.C ontrol.OnLoad(E ventArgs e) +67
System.Web.UI.C ontrol.LoadRecu rsive() +29
System.Web.UI.P age.ProcessRequ estMain() +724
Anyway, thanks all!
Comment