在VS2008中插入数据时可能出现的错误

在VS2008中通过代码插入一条数据MOSS的列表时,可能出现下面的异常

Microsoft.SharePoint.SPException

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

解决方法:

在执行item.Update()之前先设置SPWeb对象的web.AllowUnsafeUpdates = true即可。

原文地址:https://www.cnblogs.com/lxcsmallcity/p/1526185.html