Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Suddenly I get the following error at a lot of instances:

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

I do not know what causes this error, I get it when:

-I try to edit a page.

-I try to create a new page.

-I try to edit the navigation settings.

Has anyone had this error before in the same setting as I have?

I have searched the internet but they are all speaking of AJAX and ASP.NET while I did not program anything for my SharePoint!

How can this error suddenly occur?

All comments and questions about my question are welcome.

edit

I recently found out that this error only occurs when I acces the web page through a https://(Alternate Acces Mapping) connection. When using the standard server address, everything works fine.

share|improve this question

2 Answers 2

Yep, i have run into this before in SharePoint but it was when I was doing AJAX. Essentially, when a control is added to the page, like a dropdownlist, if those options in the dropdownlist change on the client side through javascript or something else, and you post back, since the options don't match what was originally sent to the browser, ASP.NET thinks someone is trying to hack the site and will generate this error. I ran into it because I was updating a dropdownlist using javascript and ajax. I had to use the Page.ClientScript.RegisterForEventValidation to register my new values I was returning through ajax as allowed values for that control.

In your case, can you verify whether there is any custom code / webpart running in your masterpage or on this pages? Is there any custom javascript being loaded?

share|improve this answer
    
First of all thanks for the quick reply, i have removed allweb parts from my page. The weird thing is that i can edit the page through the standard server adress, but not through the https://(Alternate Acces Mapping) Adress. Any ideas? –  nldev Sep 19 '11 at 6:54
    
Do you have any load balancing on the alternate access mappings url? If so, make sure that have single client affinity (sticked) setup correctly. So that each request from a given session will always resolve to the same server. –  Steve Lineberry Sep 19 '11 at 12:17
    
Well we are using the ISA server to do the load balancing so, correct me if i am wrong, we are using reverse proxy. I do not think that this is causing the error because we have several web sites with the same settings and those all work fine and do not show this kind of behaviour –  nldev Oct 3 '11 at 13:29

It is not an SharePoint thing it is a ASP.Net validation thing, to protect against injection attacks. That is why you do not find anything specific for SharePoint.

Regardless if it is SP or ASP.Net Web Forms the same still applies. Your Postback data needs to be valid (ASP.Net needs to know about it)

  • The bad alternative is to set <%@ Page EnableEventValidation="false" %>
  • Another solution is to use ASP.Net AJAX UpdatePanels to contain your drop down and update them.
  • Register the values in ClientScript.RegisterForEventValidation("DropDown1", "Value"); in the Render event of your page. Like `protected Override void Render(HtmlTextWriter writer) { ClientScript.RegisterForEventValidation("DropDown1", "Value1"); ClientScript.RegisterForEventValidation("DropDown1", "Value2"); ClientScript.RegisterForEventValidation("DropDown1", "Value3");

base.Render(writer); }`

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.