Sharepoint:The security validation for this page is invalid. Click Back in your Web browser
Sometimes while trying to delete documents or move documents from one library to another we get an error "The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again” while trying to move documents from one document library to another document library."
This error is caused due to security validation. So there should be a way out to turn it off. One method to turn off security is:
Central Administration—>application management—->web application general settings–>turn security validation off
But, if we always keep it on there might be danger of malicious code.
So, we should handle this through coding, turn off security validation for our code to execute and then again turn it on.
SPWeb ospWeb = SPContext.Current.Web;
Microsoft.SharePoint.Administration.SPWebApplication webApp = ospWeb.Site.WebApplication;
webApp.FormDigestSettings.Enabled = false;
// our code should be inserted here
webApp.FormDigestSettings.Enabled = true;
For more details, visit http://techolyvia.wordpress.com/2008/10/24/the-security-validation-for-this-page-is-invalid-click-back-in-your-web-browser-refresh-the-page-and-try-your-operation-again/