Invalid postback or callback argument
This is mistake
Invalid postback or callback argument. Event validation is activated by using in configuration or <% @Page EnableEventValidation = "true"%> on the page. For security reasons, this function verifies that the arguments for postback or callback events come from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method to register the postback or callback data for validation.
and I also get them about the same often
The status information is not valid for this page and may be damaged.
I've read about 20 other Wrong Answer or Callback Questions and Answers and I don't think mine falls into any of the general categories:
- Dynamically created or modified controls that ASP.NET was not aware of
- Users submitting a code or bit of code like "<" and ">"
- bind data in every Page_Load event without using if (! IsPostBack) is smart
- faulty AJAX extender CascadingDropDown
- Russians are trying to hack your site (!)
- Periodic problems with users via dialup (!)
- Inconsistencies between versions of ASP.NET, such as having a server farm running concurrently with ASP.NET 1.1 and 2.0.
I THINK my question is the most similar to the last one on this list.
I am getting intermittent (but frequent) errors in my test environment with load balanced on Microsoft Azure Web Server after form postback.
I notice that the problem occurs when a page created by one of the servers is posted back to the other. When I remove load balancing (just push only one server), the problem goes away.
I am using Win Server 2008 R2 (IIS7.5) on one web server and Win Server 2012 (IIS8) on the other (I was familiar with 2008 and am afraid of 2012, but want to learn, so I chose to run one of each to hedge my bets, in case you're wondering).
2008 machine runs ASP.NET version "4.0.30319. 272 " and 2012 runs "4.0.30319. 18010 ", but obviously different IIS versions.
But they both work with ASP.NET 4.0. .NET is supposed to make a transparent operating system transparent, right? So I'm not sure what is causing the problem.
Rebuilding one server to make them the same would be quite a daunting task and would rather avoid it unless minor ASP.NET differences are causing the problem!
So are there any other reasons why two servers won't accept each other's forms on postback? FYI, I already added an entry to my web.config file on both servers to fix the "Error Checking in View" errors I was getting.
Or are there any configuration changes I could make to make the servers more compatible?
Thank!
source to share
So, I spent half a day rebuilding my web farm and did both 2008R2 servers and the problem went away!
My (tentative) conclusion is that the problem was caused by differences in viewstate handling between .NET 4.0.30319 ... versions on server 2008R2 versus 2012 (including a completely different format __EVENTVALIDATION
).
I can't be sure about this because maybe the way I installed server 2012 was different from server 2008R2. But then, while building the 2012 server, I strictly adhered to the 2008R2 build document I wrote, so like the two days I spent building to get it to work, I’m confident that I’m not missing out on anything- then the obvious.
Moral of the story (about 80% certain): Don't mix server versions in ASP.NET deployments, even if the .NET version is the same.
source to share
I had the same problem as the Farm system. I tested several solutions and it worked:
- Generate a machineKey on one system and then replicate to another. (I found this solution on several forums, but it alone does not work)
- Supply the same compatibility type. For me it was "Framework45". (From this configuration started working).
Example:
<system.web>
...
<machineKey compatibilityMode="Framework45" decryptionKey="808A25F38661B8799CFD5B6FC5CF73D2988F5786CE46075D" validationKey="B75D59843CA111DF8596FCF865D9C0459B63B6ED474D4B23FD63A5F3A5AB18560A0D2A162191EC3354650CB37B174DDE187B29D424FC5CF60EFDA567BA64D3A3" />
...
</system.web>
source to share
For us, the problem only happened randomly in a production environment. RegisterForEventValidation did nothing for us.
Finally, we found out that in the web farm that the asp.net application was running on, the two IIS servers had different versions of .net installed. It looks like they had different rules for encrypting the asp.net validation hash. Updating them solved most of the problem.
In addition, we configured machineKey (compatibilityMode) (the same on both servers), httpRuntime (targetFramework), ValidationSettings: UnobtrusiveValidationMode, pages (renderAllHiddenFieldsAtTopOfForm) in the web.config of both servers.
We used this site to generate a key https://www.allkeysgenerator.com/Random/ASP-Net-MachineKey-Generator.aspx
We spent a lot of time solving this problem, I hope it helps someone.
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
...
</appSettings>
<system.web>
<machineKey compatibilityMode="Framework45" decryptionKey="somekey" validationKey="otherkey" validation="SHA1" decryption="AES />
<pages [...] controlRenderingCompatibilityVersion="4.0" enableEventValidation="true" renderAllHiddenFieldsAtTopOfForm="true" />
<httpRuntime [...] requestValidationMode="2.0" targetFramework="4.5" />
...
</system.web>
source to share