that is probably you are running your code in localhost as admin right, but if a
regular user access iis, they dont have it, then it will return error, what you
might do is put your code as component on iis, that should work for you
--- On Sun, 10/19/08, pio_richard <pio_richard@...> wrote:
From: pio_richard <pio_richard@...>
Subject: [ADSI-DirSrv] works as localhost but not in IIS
To: ADSIANDDirectoryServices@yahoogroups.com
Date: Sunday, October 19, 2008, 9:26 AM
Hi, Here is the code that i am using to authenticate a user. this
works fine when i work with localhost(asp. net 2005 inbuilt iis). but
when i deployed the page to a IIS webserver then it throws "An
operations error occurred".
Here is my code:
bool IsExistInAD( string loginName)
{
string userName = loginName;
bool retVal = false;
try
{
string strLDAP = "LDAP://cn=xxxx, ou=xxxDistributi on Lists,ou=ZZ
DXB,ou=domainname, dc=SD01,dc= domainname, dc=st";
DirectoryEntry objDirEntry = new DirectoryEntry
(strLDAP, "domainname\ \username" , "password",
AuthenticationTypes .Secure);
//objDirEntry. Path =
Response.Write( objDirEntry. Username. ToString( ));
DirectorySearcher search = new DirectorySearcher
(objDirEntry) ;
search.Filter = String.Format( "(SAMAccountName ={0})",
userName);
search.PropertiesTo Load.Add( "cn");
SearchResult result = search.FindOne( );
if (result == null)
{
retVal= false;
}
else
{
retVal= true;
}
}
catch (Exception ex)
{
Response.Write( "IsExistInAD - " + ex.Message.ToString ()
+ "<br>");
Response.Write( "IsExistInAD - " + ex.Source.ToString( )
+ "<br>");
//Response.Write( userName) ;
}
Response.Write( retVal.ToString( ));
return retVal;
}
ALWAYS IT RETURNS FALSE...
[Non-text portions of this message have been removed]