c# - Ensure that a string is not an sql command -



c# - Ensure that a string is not an sql command -

is there

checkstringforsql(string);

for c#?

i know can utilize parameters, 1 of stored procedures uses sp_executesql parameter comes xml document. theoretically can run sql commands, if know set them in.

any ideas?

the right way avoid sql injection through parameterized queries, encode values wouldn't fit sql context they're beingness injected into.

supposing there's vast mass of legacy code know vulnerable sql injection, still seek checking suspicious values on input in part of code. example, default asp.net tries prevent javascript/html injection using filter on every request.

but approach open false-positives, reject legitimate info because looks intended injection attack. , it's not reliable writing data-access code best practices in first place.

c# .net security sql-injection

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -