Вопрос

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?

Это было полезно?

Решение

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. 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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top