Monday, October 18, 2010

Sharepoint Trivia -- 1

Since I have been working on Microsoft Sharepoint for quite a long time now.
So thought of writing my blog about my experience with it.

The post under this header will contain the errors I faced and how I resolved them.
As there wasn't enough information given on internet so had to go through the documentation
several times and than can to know, that just one small thing was missing.
So thought of saving others from the pain of this.

##############
Error ::
~~~~~~~~~~~~~~~
"Microsoft.SharePoint.SPException: The security validation for this page is invalid."
###############


##############
Resolution ::
~~~~~~~~~~~~~~~
To be able to call into the SharePoint object model directly from an InfoPath browser form and perform updates, you must set SPWeb.AllowUnsafeUpdates to true.
The MSDN documentation on SPWeb.AllowUnsafeUpdates says:
The SPWeb.AllowUnsafeUpdates property gets or sets a Boolean value that specifies whether to allow updates to the database as a result of a GET request without requiring a security validation.
The documentation further states the implication of setting SPWeb.AllowUnsafeUpdates to true. Setting this property to true opens security risks, potentially introducing cross-site scripting vulnerabilities. So ensure you set SPWeb.AllowUnsafeUpdates to false immediately after running the code that calls into the SharePoint object model.
##############

No comments: