Search the web
Sign In
New User? Sign Up
ADSIANDDirectoryServices · ADSI and System.DirectoryServices Q&A
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
works as localhost but not in IIS   Message List  
Reply | Forward Message #4568 of 4632 |
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=xxxDistribution 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.PropertiesToLoad.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...




Sun Oct 19, 2008 2:26 pm

pio_richard
Offline Offline
Send Email Send Email

Forward
Message #4568 of 4632 |
Expand Messages Author Sort by Date

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...
pio_richard
Offline Send Email
Oct 25, 2008
7:54 pm

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...
wei huang
weihuangzhu
Offline Send Email
Oct 27, 2008
1:36 pm

Or perhaps look into the 'account impersonate' (account with admin rights) setting to put into your web.config. From: ADSIANDDirectoryServices@yahoogroups.com ...
Andrzej Raczynski
araczynski
Offline Send Email
Oct 27, 2008
1:38 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help