Is it possible to prevent parameter tampering by using parameterized queries in classic asp. If it's not what is the proper way to prevent it?
Thank you.
Is it possible to prevent parameter tampering by using parameterized queries in classic asp. If it's not what is the proper way to prevent it?
Thank you.
Assuming that you are using ADODB
to make your SQL queries you could parametrize them like so:
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "some connection string"
set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = conn
cmd.CommandText = "SELECT * FROM some_table WHERE id = ?"
cmd.CommandType = adCmdText
cmd.Parameters.Append cmd.CreateParameter("@id", adInteger, adParamInput, request("id"))
set rs = cmd.Execute
...
%>
In this example the id
parameter in the query is parametrized as it is coming from user input (request("id")
).