Tuesday, September 21, 2010

System.ArgumentException: Invalid postback or callback argument

I've been going nuts on this one, and still don't have a good answer.
Basically, one of our web servers, using identical code (ASP.NET 3.0) as the production server (which works fine), suddenly decided to give me a "System.ArgumentException: Invalid postback or callback argument" every time I'd attempt to log in at the web site.  This was our QA box, used for final testing just before pushing stuff into production.  A quick Google search seemed to give some basic information--I had to used the Page EnableEventValidation="true" (you'd be stupid to set it to false), so the error did make some kind of sense.  But I could not overcome the issue.  There was no binding in the code-behind, so suggestioins of using !IsPostBack were useless.  The StackTrace suggested the error occurred on a TextBox, but there were only two textboxes: one for the username and one for the password.  Our development box worked fine and the production box worked fine. So what was the problem?
I tried all sorts of things--switching to Firefox, rebooting the QA servers, even restoring all production code onto the QA servers, and NOTHING!  The error just would not go away.  I added some code into development to do "ClientScript.RegisterForEventValidation" on ALL visibile controls, but I knew this really couldn't have anything to do with it--and I really didn't want to push development code into QA at this time.  I even checked the certificates (all websites are running using HTTPS) and noticed the QA box was running with an expired certificate--so I updated it, but still nothing.
In desparation, I finally tried logging into the website from a different computer--and lo and behold, it worked.  Okay, must be my PC, then--so I went back to my PC and tried logging in--this time it also worked.
WTF?  Well, at least if it happens again, I know how to clear it up.  But boy, I'd certainly appreciate any comments that could explain what happened and how to ever keep it from happening again.