I have a basic C# windows form that allows the user to update a specific field in our MySQL database from a Windows machine. What is the best way to check the string input values in the C# form in order to alter the string to include backslashes for comma’s etc but also to prevent against any form of SQL injection?
Many thanks.
Generally the quickest approach I’ve seen is to use an ISAPI filter, like these:
http://www.iis.net/extensions/UrlScan
http://iis6sqlinjection.codeplex.com/
You should also be using Parameter Commands with Stored Procedures.
While your doing this you maze well protect against XSS attacks too, here a fantastic article:
http://corneliutusnea.wordpress.com/2009/12/11/xss-attack-your-database-to-detect-missing-output-encoding/