Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 969548 - Last Review: March 26, 2009 - Revision: 1.1
ASP.NET 2.0 : Event validation fails when postback occurs before a page is rendered completely
Source: Microsoft Support
RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.
Event validation fails on slow network connections when postback occurs before a page is rendered completely.
The following error message is logged:
Exception information:
Exception type: ArgumentException
Exception
message: Invalid postback or callback argument. Event validation is enabled
using <pages enableEventValidation="true"/> 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.
In versions that are earlier than the .NET Framework 3.5 SP1, ASP.NET renders some hidden fields, such as the __VIEWSTATE field, at the top of the form. Other hidden fields, such as the __EVENTVALIDATION field are rendered near the bottom of the form, immediately before the closing </div> tag.
If event validation is enabled for ASP.NET page and the postback occurs before the page is rendered completely, then __EVENTVALIDATION field is not included in the data that is being posted. Therefore, the .NET Framework treats the postback as invalid.
To fix the issue, upgrade the system to the .NET Framework 2.0 SP2 or the .NET Framework 3.5 SP1.
By default, in ASP.NET 3.5 SP1, all system-generated hidden fields are rendered at the top of the page. This makes sure that the information in these fields is sent to the server even if a postback is performed before the page has finished loading.
If you want to render system-generated fields at the bottom of the page, set the
RenderAllHiddenFieldsAtTopOfForm property to
False.
Note If you perform a postback before the page has finished loading, an "Invalid postback or callback argument" error may occur.
Visit the following sites for information that is related to this article:
PagesSection..::.RenderAllHiddenFieldsAtTopOfForm Proper
(http://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.renderallhiddenfieldsattopofform.aspx)
ASP.NET Debugging: validation-of-viewstate-mac-failed-error
(http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx)
MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEB SITE (THE “MATERIALSâ€) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.
APPLIES TO
- Microsoft .NET Framework 2.0 Service Pack 1 (x86)
| kbrapidpub kbnomt KB969548 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please