Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > BOOK: Beginning ASP.NET 4 : in C# and VB
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old April 29th, 2010, 04:13 PM
Friend of Wrox
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts
Default Getting an error in chapter 13

At the page 438, no. 10. Sometimes i get this Exception occuring when i change the page or edit some items..

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.
What this mean ?

Reply With Quote
  #2 (permalink)  
Old May 1st, 2010, 04:31 AM
Imar's Avatar
Wrox Author
Points: 71,804, Level: 100
Points: 71,804, Level: 100 Points: 71,804, Level: 100 Points: 71,804, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,048
Thanks: 80
Thanked 1,581 Times in 1,558 Posts

Hi there,

You can get this error for a number of reasons. The most common one is in a situation where the client page (HTML) submits to the server through controls that don't exist (anymore) in the page.

So, let's say your browser shows a button called btnSubmit. On the server, you rename the button in the ASPX page to SubmitButton and then click btnSubmit (or press Ctrl+F5)in the browser to reload the page. Then the browser submit to the server with btnSubmit as the postback control. However, at the server this control no longer exists and you get the error you posted.
You may also run into this when programmatically adding and removing controls from a page through code.

This feature was added to prevent abuse. For example, consider this:

DeleteButton.Visible = User.IsInRole("Administrators");

When the user is not an admin, she doesn't see the DeleteButton. However, you could hack your way around this by adding an HTML button to a fake HTML page and submit. The event validation stops hackers from abusing this mechanism as it requires controls that submit to the server to be in the initial request before the post back.

Hope this helps,

Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Rushino (May 1st, 2010)
  #3 (permalink)  
Old May 1st, 2010, 08:18 AM
Friend of Wrox
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts

Yeah i understand the problem. But every control was there in the first request.. and i havent changed name of any.. actually ive just fellowed your book but when i retried the page.. now the problem seem fixed.. still strange lol anyway thanks for the explanation.
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 13 Error Psyclist BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 12 February 15th, 2010 07:49 PM
LINQ Error ? Chapter 13 workidoo BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 July 22nd, 2008 10:37 AM

All times are GMT -4. The time now is 01:24 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.