Remember event validation works by combining the hash of a control’s Unique ID property and a hash of each legal value for that control.The Register For Event Validation method accepts both of the calculation inputs as parameters.Another issue is that the number of legal values might be extremely large. NET doesn’t expose a property to disable event validation for a single control – this would be a nice feature to have.However, if we create a custom control and leave off the Supports Event Validation attribute, we’ll effectively disable event validation for instances of that class. I have an AJAX postcode finder that has just fallen over. I was having this problem with some AJAX stuff that places two input texts and submit button in a div container.In our example, we knew we only had one additional legal value – the value “4”.We need to call Register For Event Validation for every legal value the control might postback.If the user selected the 4th option and posted the form to the server, the server would throw an exception because it didn’t know “4” was a legal value. NET know the value “4” is legal with the Register For Event Validation method of the Client Script Manager class.Register For Event Validation must be called during the rendering phase, so we need to override a Render method.
We can disable event validation for an entire site in the web.config file.
Tsay email: [email protected] and Comments are welcome and appreciated.
Copyright: All rights reserved Acknowledgement: Previous versions of this book was published by Pearson Education, Inc.
Once it comes to serverside validation, it's your job to make sure that no sensitive code is executed unless you want it to.
As you see, it's very simple - just check the Page. Try to run the website again, and notice how the text of the button is changed if you submit a valid form.