Friday, March 8, 2013

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:

Regex obfuscate email

 Use this code in C# to obfuscate email using regex // Online C# Editor for free // Write, Edit and Run your C# code using C# Online Compile...