KENTICO AND ACTIVE DIRECTORY

alzo alzo asked on June 2, 2017 15:25

HELLO I NEED THE HELP MY IRROR IS :

An operations error occurred. 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.DirectoryServices.DirectoryServicesCOMException: An operations error occurred.

Source Error:

Line 44: using (var domainContext = new PrincipalContext(ContextType.Domain, "shsjdc01.sainte-justine.intranet")) Line 45: { Line 46: using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, userName)) Line 47: { Line 48: return foundUser != null;

Recent Answers


Prashant Verma answered on June 5, 2017 05:55

Hi Alzo,

I had exactly the same error and fixed it by changing the site's application pool to run under the Network Service.

In IIS:

  • Select your site's application pool
  • Select Advanced Settings on the right-hand side
  • On the Advanced Settings pop-up window, scroll down to the Process Model group
  • Change the first option called Identity to NetworkService (mine was set to the default ApplicationPoolIdentity).

Thanks

Happy to help you

1 votesVote for this answer Mark as a Correct answer

alzo alzo answered on June 5, 2017 15:11 (last edited on June 5, 2017 21:19)

HELLO I TRIED YOUR SOLUTION BUT I HAVE THE ERROR. In IIS:

Select your site's application pool
Select Advanced Settings on the right-hand side
On the Advanced Settings pop-up window, scroll down to the Process Model group
Change the first option called Identity to NetworkService (mine was set to the default ApplicationPoolIdentity).

MY CODE IS WORKING IN MY SEREVER DEV BUT IN SERVER PROD NOT WORK : public bool DoesUserExist(string userName) { using (var domainContext = new PrincipalContext(ContextType.Domain, "XXXXXXXXXXXXX")) { using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, userName)) { return foundUser != null; } } }

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.