The Security Validation is invalid – SharePoint Application Page

20 10 2008

I was working on a SharePoint Application Page to allow limited users to cancel a workflow on a certain item in a Document Library and leave some Comments.

When testing my solution, I recieved the following error: “The security validation for this page is invalid. Click Back in your Web browser…”

This is due to the security applied to the SharePoint site, it disables the request as it deems it as harmful. In order to correctly execute the code, you will need to allow unsafe updates to the SharePoint site while the code is performed.

Before the code you wish to perform add the following:

web.AllowUnsafeUpdates = true

This will allow your code to execute, however in order to protect the security on the SharePoint site make sure you set this to false at the end of your code:

web.AllowUnsafeUpdates = false

Hope this helps some of you, it was bugging me for ages! 🙂

Advertisements

Actions

Information

One response

15 06 2009
sacbar

I have written a web service and used the SPSecurity.RunWithElevatedPrivileges to access a list to do some operations. But when I access that web service through the application, it asks for user name and password. Ideally it should not ask for user name and password. Please tell me – what should I have to do so that user name and password will not be asked for accessing the web service?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: