Using C # in the. NET environment to prevent SQL injection attacks

Source: Internet
Author: User
Tags sql net sql injection access
Using C # in the. NET environment to prevent SQL injection attacks, our solution is:

1, first in the UI input, to control the type and length of data, to prevent SQL injection attacks, the system provides detection of injection-type attack function, once the detection of injection-type attack, the data can not be submitted;

2, the Business Logic layer control, by the method inside the SQL keyword in a certain way to screen out, and then check the length of data, to ensure that the submission of SQL, there will be no SQL database injection attack code; However, when this is done, the masked characters are restored when the UI output is required. So the system provides functions for shielding characters and for restoring characters.

3, in the data access layer, the vast majority of the use of stored procedures to access data, calls to stored procedure parameters in the manner of access, will also be good to prevent injection-type attacks.



Related Article

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.