SharePoint 工作流中的无效安全验证异常
我的 SharePoint 工作流遇到了奇怪的安全问题。特定的调用似乎会导致以下异常:
Microsoft.SharePoint.SPException: 该页面的安全验证是 无效。
我以前遇到过这个错误,简单的修复方法是
web.AllowUnsafeUpdates = true;
...
web.AllowUnsafeUpdates = false;
但是,自从工作流程作为系统运行以来,我以前从未在工作流程中遇到过这个问题。我首先在代码活动中遇到此错误,其中我设置了列表项上的列的值。将 item.Update 包装在AllowUnsafeUpdates 中修复了该问题。
在代码活动之后,我有一个 CreateTask 活动。这也会导致相同的错误,但仅在运行活动的 MethodInvoking 内的代码之后才会发生。
在这两种情况下,堆栈跟踪中都会涉及 SPListItem.UpdateItem。此呼叫未通过安全检查。我不知道这项检查是如何运作的,所以我不知道下一步该去哪里。
这是一个奇怪的情况,因为这台 SharePoint 开发机器已经正常工作了一段时间了。没有其他项目或工作流程表现出此行为,因此排除了安装问题。这个特定的工作流程有一些东西。
[更新] 我通过创建一个新项目并再次构建它来解决这个问题。我还留着那个坏掉的,我仍然想找出它的问题所在。如果有任何关于它可能是什么的建议,我将不胜感激。
I'm having a strange security problem with a SharePoint workflow. Particular calls seem to result in the following exception:
Microsoft.SharePoint.SPException: The
security validation for this page is
invalid.
I've come across this error before and the simple fix is
web.AllowUnsafeUpdates = true;
...
web.AllowUnsafeUpdates = false;
However I've never once encountered this problem inside a workflow before since a workflow runs as system. I first got this error in a code activity where I set the value of a column on the list item. Wrapping the item.Update in AllowUnsafeUpdates fixed it.
After the code activity I have a CreateTask activity. This also causes the same error but only after running the code inside the activity's MethodInvoking.
In both cases there's a SPListItem.UpdateItem involved within the stack trace. This call is failing a security check. I don't know anything about how this check works so I don't know where to look next.
This is a strange one, because this SharePoint dev machine has been working fine for some time. No other projects or workflows exhibit this behaviour so that rules out an installation problem. There's just something about this particular workflow.
[UPDATE]
I've gotten around the issue by just creating a new project and building it up again. I still have the broken one and I'd still like to figure out the problem with it. I'd appreciate any suggestions of what it might be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还没有在工作流程中看到这种情况发生,但我见过两种情况。也许其中之一会有所帮助。
I haven't seen this happen in a workflow, but there are two cases where I have seen it. Maybe one of those will be helpful.