Need help with postback/callback argument error!

VBISCOOL2
09-20-2006, 03:02 AM
Hello.

I have a webform with a button and a text box. I am also using a codebehind file. When the user presses the button a connection to the database is made and a stored procedure is executed and the number of rows affected is returned.

This is my @Page:

<%@ Page EnableSessionState="false" EnableEventValidation="true" EnableViewState="false" Language="VB" CodeFile="index.aspx.vb" Inherits="IndexPg" %>

However, I am getting the following error when I press the button at runtime:

==========================================================

Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------

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.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: 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.


----------------------------------------------------------------

Thanks for any help! ;)

wayneph
09-20-2006, 07:18 AM
Does it work if you change EnableEventValidation to False? I've never personally used this feature, so we may have to take a few steps to figure this out.

Also, Are you using the ClientScriptManager.RegisterForEventValidation() anywhere in your code?

I'm assuming this is .NET 2.0?

VBISCOOL2
09-20-2006, 08:15 AM
Does it work if you change EnableEventValidation to False?
I'm assuming this is .NET 2.0?




Wow! That worked. :D I'm using 2005. Well that was pretty simple I guess.

Cheers!

wayneph
09-20-2006, 10:54 AM
You turned on one of the security checks, and then violated it. By setting it to false, you're potentially opening yourself up to attacks. I'd take a look at the other function mentioned as well, to tighten up security.

VBISCOOL2
09-22-2006, 03:15 AM
I see your point Wayneph but I'm not quite sure how to use the ClientScriptManager.RegisterForEventValidation () function.

Fortunately this page will only be used/accessible to about 5 people who I work with so security won't be too much of an issue.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum