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归因
scroll top