Background
Tried using a dated .Net Application that I wrote quite a long time ago.
I accessed a drop down, selected an item from the drop down, and clicked a push button.
Errors
Error – “Invalid postback or callback argument. Event validation is enabled using…”
Unfortunately received an error that reads:-
Text
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.
Image
Troubleshooting
The error reads:-
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation=”true”/> in configuration or <%@ Page EnableEventValidation=”true” %> in a page.
It appears that:-
- System Wide
- Web.Config
- It appears that we have an entry in the web configuration file that is enabling enableEventValidation
- Web.Config
- Specific Web Page
- We have “EnableEventValidation” set to true on our specific faulting page
Remediation
Page
Checked the ASPX Page and confirmed that we do not have a page directive that references EnableEventValidation.
Web.Config
Outline
- Disabled Request Validation system wide.
Code
<system.web> <!-- added on 2022-06-19 10:22 PM by dadeniji to address error "Invalid postback or callback argument" --> <pages validateRequest="false" /> </system.web>
Advisory
Web.Config
enableViewStateMac
Disable enableViewStateMac
One of the posters to a related StackOverfow Q/A post suggested disabling enableViewStateMac.
That option is no longer valid.
Please read more here:-
- Microsoft
- Microsoft .NET
- Levi Broderick
- Farewell, EnableViewStateMac!
Authored On:- September 9th, 2014
Link
- Farewell, EnableViewStateMac!
- Levi Broderick
- Microsoft .NET
References
- Stack Overflow
- A potentially dangerous Request.Form value was detected from the client
Link
- A potentially dangerous Request.Form value was detected from the client
Summary
The error seems to only occur a only the first few times one self posts to a page.
One can live with it.
If you choose to make the change please be conservative.
- Understand the implications of setting validateRequest off
- Backup the website artifacts
- Make the change
- Monitor to make sure that the error is indeed addressed
- Determine whether you have introduced other concerns or errors