If you need to work with SPSecurity.RunWithElevatedPrivilegs() to do for example Site or Web manipulations (the normal user has no rights to do it), you run sometimes into the following error:
"The security validation for this page is invalid. Click Back in your Webbrowser, refresh the page, and try your operation again."
Now, depending on what operation you want to do exactly, this can be solved by
a) Setting SPWeb.AllowUnsafeUpdates = true and/or
b) turning SPWebApplication.FormDigestSettings.Enabled off
Note that I really recommend to set both values back to AllowUnsafeUpdates = false and FormDigestSettings.Enabled = false after you did your stuff. If not you will leave (especially with having Security Validation turned off) a big security hole.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment