Skip to content Skip to sidebar Skip to footer

Linq To Sql And Sql Injection

What do I need to add, if I need to at all, to avoid sql injections? public static Login GetLoginByName(string name) { var context=new telephonyEntities1(); Login t = (fro

Solution 1:

Linq-to-sql uses SqlParameter to generate SQL queries, so no you do not need to do anything extra.

From Frequently Asked Questions (LINQ to SQL)

Q. How is LINQ to SQL protected from SQL-injection attacks?

A. SQL injection has been a significant risk for traditional SQL queries formed by concatenating user input. LINQ to SQL avoids such injection by using SqlParameter in queries. User input is turned into parameter values. This approach prevents malicious commands from being used from customer input.

Post a Comment for "Linq To Sql And Sql Injection"