Monday, October 25, 2010

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

Today, I try to create a hidden list and then get its schema. My purpose is to know how many columns in each of list type. But I did not logged in the site by owner, just used  Contribute account to do creating. Unfornately, Contribute account does not have the right to create a new list, only can create a new view or new item in the list. So, I get the error if I try to create:

[COMException (0x8102006d): The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.]


Now, take a look at my code:

After search on the internet, I read the blog from: Tushar Parikh. He recommended to re-config Security of the Web Application:

Central Administration -> Application Management -> Web Application General Settings ->Select web application

In Web Page Security Validation , change security validation is off. 


I tried the following his instruction and it worked for me, but the another problem is just worked for PostBack page. But in recent, my page is running under ajaxified. So, I must turn the security validation on. But I found another blog and I resolved the problem.

Here is the blog:
http://community.bamboosolutions.com/blogs/bambooteamblog/archive/2008/05/15/when-allowunsafeupdates-doesn-t-work.aspx

My code was changed:

AllowUnsafeUpdates property is very useful if you want to update the property bag of Web or Site object. It takes me 1 hour to research and fix the problem... Thanks for all

No comments: