The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again. You may face this error many times while updating Library or Lists items.  

Problem Cause

This error is caused due to security validation. This problem occurs if both of the following conditions are true:

The Windows SharePoint Services Web site is configured to use Anonymous Access in addition to another method of authentication, such as Basic Authentication. 

We are inserting, updating or deleting the items from this list or document library and we don’t have the rights to perform these operations. 


There is two ways to turn it off. 

Turn off security : 

# Open Central Administration
# Goto Application management
# Click on Web application general settings
# Turn security validation off

Note: But, always keep it on might be dangerous of malicious code.

Change the Security settings of a Web Application

We can handle the above setting through code. Turn off security validation from code to execute and then again turn it on.

   objWeb.Site.WebApplication.FormDigestSettings.Enabled = false;
   item["Title"]="Test Title";
   objWeb.Site.WebApplication.FormDigestSettings.Enabled = true;

Note: This will affect the WebApplication. This will change the Security settings of a Web Application to allow the anonymous user to update item.

Using the follwoing code

   objWeb.AllowUnsafeUpdates = true;
   item["Title"]="Test Title";
   objWeb.AllowUnsafeUpdates = false;

Copyrights 2018,