Invalid security validation exception inside a SharePoint workflow
Posted
by Dan Revell
on Stack Overflow
See other posts from Stack Overflow
or by Dan Revell
Published on 2010-04-12T16:51:39Z
Indexed on
2010/04/12
17:13 UTC
Read the original article
Hit count: 493
sharepoint
|Workflow
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.
© Stack Overflow or respective owner