Solved

Invalid postback or callback argument

Posted on 2008-06-12
16
1,081 Views
Last Modified: 2013-12-17
I receive this error on a page with a button, and only a button and text. I have seen some articles on the internet, but don't really see a good answer. Security is important for my Internet app. This page works fine when I am not autenicated. The web application has a login page, where users login and get authenicated. When I users are authenicated and then access this page, the error occurs. Any suggestions?

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.
0
Comment
Question by:gtrapp
  • 8
  • 7
16 Comments
 
LVL 19

Accepted Solution

by:
elimesika earned 200 total points
ID: 21774354
HI

The error you have got is very descriptive , you have to add a property to your page (see code)

see

http://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.enableeventvalidation.aspx
 <%@ Page EnableEventValidation="true" %>

Open in new window

0
 

Author Comment

by:gtrapp
ID: 21780047
Yes, I was thinking about your solution before I asked the question, but what about security issues? Are there any problems with setting this in regards to security?
0
 

Author Comment

by:gtrapp
ID: 21780294
I get the following error message:

The 'EnableEventValidation' attribute is not supported by the 'page' directive.

When adding EnableEventValidation="false". My page directives look like this:

<%@Page language="c#" Codebehind="RequestLoginHelp.aspx.cs" AutoEventWireup="false" EnableEventValidation="false" Inherits="pbFamily.RequestLoginHelp" %>

Any suggestions?
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 6

Assisted Solution

by:divyeshhdoshi
divyeshhdoshi earned 50 total points
ID: 21784594
Hi,

set EnableEventValidation="true" in <%@ Page />
like
<%@ Page EnableEventValidation="true" %>

Regards,
Divyesh Doshi
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21786297
HI

The following is taken from MS help , I suggest that you set this flag to true , try to set it in page_init as described below or in your config file

The event validation mechanism reduces the risk of unauthorized postback requests and callbacks. When the EnableEventValidation property is set to true, ASP.NET allows only the events that can be raised by the control during a postback request or callback.
[Note] Note:

This event validation mechanism reduces the risk of unauthorized postback requests and callbacks. With this model, a control registers its events during rendering and then validates the events during the post-back or callback handling. All event-driven controls in ASP.NET use this feature by default.

It is strongly recommended that you do not disable event validation. If you do disable event validation, make sure that no postback could be constructed that could have an unintended effect on your application.

In most circumstances, you set the EnableEventValidation property by setting the enabledEventValidation attribute of the @ Page directive or the enableEventValidation attribute of the pages element in the Web.config file. If you set the EnableEventValidation property in code, set it in the Page_Init phase of page processing.
0
 

Author Comment

by:gtrapp
ID: 21794736
I think my problem is that I have .Net 1.0 installed. I don't have 2.0.

Line 14:       </appSettings>
Line 15:       <system.web>
Line 16:             <pages enableEventValidation="false"/>
Line 17:             <!--  DYNAMIC DEBUG COMPILATION
Line 18:           Set compilation debug="true" to enable ASPX debugging.  Otherwise, setting
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21794830
Yes, it is

can you upgrade ?
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21794860
0
 

Author Comment

by:gtrapp
ID: 21794861
I am looking into it.
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21794882
It says that this is not supported for 1.0 , look for "1.0" in that page
0
 

Author Comment

by:gtrapp
ID: 21795368
I am going to 3.0. Any tips for going from 1.0 to 3.0?
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21795805
Yes, follow this http://blogs.msdn.com/pandrew/archive/2007/10/25/how-to-upgrade-from-net-framework-1-0-to-net-framework-3-5.aspx

and you are done

It covers migration 1.0 to 1.1. to 2.0 to 3.0 and to 3.5

GOOD LUCK
0
 

Author Comment

by:gtrapp
ID: 21799675
Something interesting:

My test environment is .Net 1.1. The production environment is 2.0.5. In the production environemnt I have set enableEventValidation="true" on the page. The Invalid postback or callback argument still occurs. I have also tried setting this in the web.config file but the error occurs.
0
 

Author Comment

by:gtrapp
ID: 21806528
On the web server with .NET 2.0, and in the web.config file I set enableEventValidation="false". The page comes up successfully with no errors with this setting. Setting it to true caused the error. Do you know why this is?
0
 
LVL 19

Expert Comment

by:elimesika
ID: 21810616
HI

see below , is there a chance that your validation occurs before the page is rendered ?

Check this threads:

http://www.velocityreviews.com/forums/t122207-aspnet-20-bug.html
http://forums.asp.net/rss.aspx?ForumID=180&PostID=1715539
0
 

Author Comment

by:gtrapp
ID: 21817756
It turns out that I need to stick with .Net 1.1. If I set the site to use ASP .Net 1.1, then this error goes away.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question