In ASP + Form, check whether the information is correct

Source: Internet
Author: User
Today's commercial websites, or personal websites, all have customer surveys. User registration and other things will inevitably use forms. Are these forms correct, it is obviously controlled by writing code. I admit that writing code is an interesting task, but every time the verification form is written by hand, we hope to improve our work efficiency, instead of spending a limited amount of time on form verification.
For other reasons, the Web application is difficult to verify user input. The HTML 3.2 specification allows you to control user feedback, but malicious or skilled users can bypass it, therefore, even with the browser-side handwritten code, the server also needs to verify to ensure security.
Below are Microsoft's staff members who give commercial websites the disadvantages of using handwritten code to control form verification.
1. Although error messages or icons are often adjacent to input elements, they are almost always located in different cells of the table.
2. There is usually an area on the page to summarize all errors.
3. Many sites contain client scripts to provide faster feedback while preventing white-white connections between servers.
4. Many websites that contain client scripts will display information boxes when an error occurs.
5. Not only will the text input be verified, but also the drop-down list and single-choice buttons will be verified.
6. If a field is blank, the site usually displays information or icons that are different from the entry when the entry is invalid.
7. Many validity checks can effectively replace common expressions.
8. Verification is generally based on the comparison results between two inputs.
90% or more verification tasks are common operations, such as checking the name or zip code. Most sites seem to be doing this again.
10. Because the difference between sites is usually too large, it is impossible to obtain a perfect solution to handle all verification tasks for each site.
If you want to confirm to your colleagues that you have a "cool" method, you can disable entering null values in the name field. Remember to select ASP.net and read the following tutorial.
ASP.net form verification process
1. The aspx file is compiled and run.
2. User input data
3. Trigger the Page_Load event
4. Modify the Web control properties and prompt where no input is found.
5. Use Html to output the page to the user.
6. Remind the user to enter
Page_Load process
The Page object contains important attributes and methods related to server-side verification. The following table lists all the Collect and methed attributes of the Page_Load attribute.
Page_Load method name description
IsValid (most frequently used) is the most useful attribute. This attribute checks whether the entire form is valid. This check is usually performed before the database is updated. This attribute is true only when all objects in the Validators set are valid and this value is not stored in the cache.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.