The security validation for this page is invalid
-
10-12-2020 - |
Domanda
Server Error when updating a field:
The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.
var creatdbyfield = spList.Fields["Created By"];
creatdbyfield.ReadOnlyField = false;
creatdbyfield.Update();
Crashing on the Update() call. Has anyone seen this before?
Soluzione
Use below code :
web.AllowUnsafeUpdates = true; //here web is the spweb object
var creatdbyfield = spList.Fields["Created By"];
creatdbyfield.ReadOnlyField = false;
creatdbyfield.Update();
web.AllowUnsafeUpdates = false;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange