Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2010, 03:13 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
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..

Quote:
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 ?

Thanks.
 
Old May 1st, 2010, 03:31 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
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!
The Following User Says Thank You to Imar For This Useful Post:
Rushino (May 1st, 2010)
 
Old May 1st, 2010, 07:18 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

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.




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 09:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.