I am trying to remove the user solution. I used
site.Solutions.Remove(Solution)
But I am getting error
The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again
I tried below things to resolve issues :
- Used web.allowunsafeupdate but nothing happened.
- Used webApp.FormDigestSettings.Enabled = true. It worked on one environment but gave access denied error on another environment. To check for access denied I tried to use user token of system account to impersonate the permission level and then created webapp object using that token, but still it gave access denied error.
- complete code is inside Runwithelevatedprivilege.
Can anyone suggest any solution.