while using spsecurity.runwithelevatedprivileges if we want to create or update a splistitem using the elevated previledges, we need to create new SPSite and SPWeb objects, but you would get an error “The security validation for this page is invalid …” since a new SPContext object is created.
There are two ways to get past this error
1) set SPWeb.AllowUnsafeUpdates = true
2) Use SPUtility.ValidateFormDigest()
No comments:
Post a Comment