5

enter image description hereI have to access the user profiles anonymously.

I have used- SPSecurity.RunWithElevatedPrivileges(delegate() to access the user profiles anonymously.

While accessing the user profiles getting the Error as:

System.UnauthorizedAccessException: The user could not be authenticated to the Web site being accessed.

How to fix it?

0

2 Answers 2

3

RunWithElevatedPrivileges elevates the code block to the Web Application App Pool Account. You need to ensure that account has access to the User Profile Service. I should point out RWEP is generally a bad idea.

1
  • Thanks! @Matthew :) I'll post my Answer Step by step soon.
    – Ram
    Oct 7, 2016 at 12:06
2
  1. Check the User of Application pool of the current web Application(In the IIS).

  2. Go to Central Admin => Manage service applications => User Profile Service Application => Administrators => Add => User of Application Pool which is mentioned in the step 1 => Select Full Control and Save it.

  3. You will see the users anonymously.

Please check image for the more details-

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.