:“The data protection operation was unsuccessful. This may have been caused by not having the user profile
loaded for the current thread’s user context, which may be the case when the thread is impersonating”}
It’s very probably caused by IIS Apppool Settings:
- Open your IIS Manager
- Find out what AppPool your application is using by selecting your App, right-click on it, and Select Manage Application ->
- After that, on the top left hand side, select Applications Pools, and go ahead and select the App Pool used by your app.
- Right-click on it, and select Advanced Settings, Go to the Process Model Section and Find the “Load User Profile” Option and
set it to true.