validation - Form - need to allow for apostrophes -
i have form written in classic asp light client-side validation. works except 1 thing - form fails when there's apostrophe. 1 of fields may have apostrophes (last name field - form fail if user's last name o'brien, example).
how fix this?
you'll have examine asp code. if see code looks like
string sql = "select user_id, first_name,last_name users username = " + myusername;
where myusername comes user, vulnerable.
the fix not try escape input (i.e., replace "'" "''") use different method outlined in article on sql injection , how avoid it
in nutshell, try following bobby-tables site
string username = "joe.bloggs"; sqlcommand sqlquery = new sqlcommand( "select user_id, first_name,last_name users username = ?username", sqlconnection); sqlquery.parameters.addwithvalue("?username", username);
Comments
Post a Comment