This error "The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again" is very common for beginners SharePoint developer, who start developing and digging into SharePoint object model, it’s coming while updating SharePoint list, the cause of error is due to security rights, if we make web.AllowUnsafeUpdates = true and then update the SharePoint list then we won’t get above error.
Sample Code:
Web.AllowUnsafeUpdates = true;
item["Title"]=”Sample”;
item.Update();
Happy Coding !!
you are opening holes to Cross scripting attacks by doing that... as mentioned in the blog from u got the code.. u need to set it back
ReplyDeleteweb.AllowUnsafeUpdates = false
Hey Sandeep,
ReplyDeleteYou are absolutely correct, we need to again set the value to FALSE after performing our update operation.
Thank you very much for your comment.
-Sanket