What are the best ways (or at least most common ways) in ASP (VBScript) for input handling? My main concerns are HTML/JavaScript injections & SQL injections. Is there some equivalent to PHP's htmlspecialchars
or addslashes
, et cetera? Or do I have to do it manually with something like string replace functions?
The bottom line is this:
Server.HTMLEncode()
does that for you.ÀDODB.Command
and ADODB.CommandParameter
objects are the right choice here.If you stick to points 1 and 2 slavishly, I can't think of much that can go wrong.
Most vulnerabilities come from not properly encoding user input or building SQL strings from it. If you for some reason come to the point where HTML-encoding user input stands in your way, you have found a design flaw in your application.