When you want to programmatically update a column for a list or library item, an error similar to the below might be thrown.
I would appreciate your comments if you may know the reason for this. If you have found this helpful, let me know that too :)
The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.Now, I have many web methods which are updating many different libraries in my site, but this particular issue occurred on one of the web methods connected to one particular library. Though I have not been able to understand why, but I was able to resolve the issue by using the following command.
myWeb.AllowUnsafeUpdate = true;
myListItem["Status"] = "Approved";
myListItem.Update();I still want to know the reason why only one of the web method and library needed this extra piece of code? All other web methods are updating library items without the use of this code.
I would appreciate your comments if you may know the reason for this. If you have found this helpful, let me know that too :)