Вопрос

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?

Это было полезно?

Решение

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;

Reference - Exception : "The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again."

Лицензировано под: CC-BY-SA с атрибуция
Не связан с sharepoint.stackexchange
scroll top