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 !!
Filed under: Personal Experience, SharePoint List, SharePoint Object Model | Tagged: and try your operation again, list item update, MOSS 2007, refresh the page, SharePoint, SharePoint List, SharePoint Object Model, The security validation for this page is invalid. Click Back in your Web browser, web.AllowUnsafeUpdates
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
web.AllowUnsafeUpdates = false
Hey Sandeep,
You 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