Developing ASP.NET MVC Web Applications — Question 93

You are developing an ASP.NET MVC application that uses forms authentication. The application uses SQL queries that display customer order data.
Logs show there have been several malicious attacks against the servers.
You need to prevent all SQL injection attacks from malicious users against the application.
How should you secure the queries?

Answer options

Correct answer: C

Explanation

The correct answer is C because implementing parameterization ensures that SQL queries are executed safely by treating input as data rather than executable code, thus preventing SQL injection. Options A, B, and D are less effective as they do not provide a comprehensive solution to SQL injection vulnerabilities, which can exploit various input formats and patterns.