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...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

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 #4571 of 4630 |
RE: [ADSI-DirSrv] works as localhost but not in IIS

Or perhaps look into the 'account impersonate' (account with admin rights)
setting to put into your web.config.



From: ADSIANDDirectoryServices@yahoogroups.com
[mailto:ADSIANDDirectoryServices@yahoogroups.com] On Behalf Of wei huang
Sent: Monday, October 27, 2008 8:36 AM
To: ADSIANDDirectoryServices@yahoogroups.com
Subject: Re: [ADSI-DirSrv] works as localhost but not in IIS



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@...
<mailto:pio_richard%40hotmail.com> > wrote:

From: pio_richard <pio_richard@...
<mailto:pio_richard%40hotmail.com> >
Subject: [ADSI-DirSrv] works as localhost but not in IIS
To: ADSIANDDirectoryServices@yahoogroups.com
<mailto:ADSIANDDirectoryServices%40yahoogroups.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]





[Non-text portions of this message have been removed]




Mon Oct 27, 2008 1:38 pm

araczynski
Offline Offline
Send Email Send Email

Forward
Message #4571 of 4630 |
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