ASP.net page.enableeventvalidation property verifies the error of postback and callback events for server controls
Source: Internet
Author: User
I thought the page was simple and did not have a problem, but the runtime encountered the following error:
The Page.enableeventvalidation property takes a look at MSDN, gets or sets a value that indicates whether the page verifies the postback event or verifies the callback event. The. NET framework needs to register for security considerations for postback and callback events for server-side controls. This event validation mechanism eliminates the risk of unauthorized postback requests and callbacks. This model allows a control to register its events during rendering and then validate them during a postback or callback. By default, all event-driven controls in asp.net use this feature.
First reaction, now that event validation is enabled, disable validation on the page, <%@ page enableeventvalidation= "false"%>, and the problem is resolved. But why is there such a problem, Google it.
If a page contains controls such as DropDownList or ListBox, the following may be the cause:
Use Ajax in the Drop-down menu, common in the provinces and cities linkage menu, possibly because the ASPX page is assigned to the Drop-down menu initial item value, when the event postback prompts the error, the drop down menu initial item value deleted, the binding event to add item.
The reason is that the Value property of the ListItem of the DropDownList control contains Chinese characters. Just change the value to English or digital. It is a good idea to add the following statement to the web.config:
Copy Code code as follows:
<globalization requestencoding= "Utf-8" responseencoding= "Utf-8" culture= "ZH-CN" uiculture= "ZH-CN"/>
Because postback does not use UTF-8 encoding, JAVASCRIPT will think it is problematic. Only change requestencoding= "Utf-8" can. If there are other suggestions, please point out.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service