سؤال

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