0

Is there a method (specially using ASP.net tools) to avoid sql injection other than parameterized queries?

Omareo
  • 123
  • 1
  • 5

2 Answers2

0

one of the simplest method is what I call sanitization. Just Replace( vsInputString, "'", "''") while constructing the SQL statement:

Dim vsSQLStatement = "SELECT * FROM table01 WHERE myField = '" & Replace(vsFormTextInput, "'", "''" ) & "';"

will also help stop SQL injection.

jlee88my
  • 2,935
  • 21
  • 28
0

Yes, of course. Other than parameterized queries, you should also consider these:

  1. Using stored procedures
  2. Using a limited access account to connect to the database (not admin level)
  3. Encrypt the ConnectionString and other sensitive data
  4. Set debug=false (in customError) to minimize the information in the event of error

I hope it helps you.

Harold Javier
  • 887
  • 2
  • 7
  • 16