3

What is the best way to avoid SQL injection on MSSQL Server from C# code using Linq?

Should you use a function to strip of security issues or is it handled by the framework?

1 Answer 1

7

Errr, you cant SQL inject using LINQ. Behind the scenes LINQ to SQL converts values into a parameterized query.

So yes it is handled by the framework.

Sign up to request clarification or add additional context in comments.

1 Comment

Technically speaking you can still have SQL injection issues if you use the ExecuteCommand or call stored procedures that use sp_execute and combine string input together without proper encoding.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.