Solved

Invalid postback or callback argument

Posted on 2008-06-12
16
1,070 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
 
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now