c# - Opening angle bracket "<" in user input causes a 404 error -


the .net app working on encounters error when user enters opening angle brackets "<" input. occurs when want sort of html input such <a href="www.google.com">google</a>

i've tried exact same input without "<" , works should. input being read asp:textbox , added parameter sql insert statement. using try catch block catch sqlexception's, particular problem not caught when change catch statement catch(exception err). know "<" used less operated in sql however, shouldn't problem because input parameter right? why "<" , not ">" in input since both characters valid sql operators? here actual code snippet.

try {     sql_command.connection = sql_connection;     sql_command.commandtext = "insert tabl1 ([id], [fname], [lname], [bio]) values (@id, @first, @last, @bio)";     sqlparameter id, first, last, bio;     id = new sqlparameter("@id", id_text.text);     first = new sqlparameter("@first", firstname_text.text);     last = new sqlparameter("@last", lastname_text.text);     bio = new sqlparameter("@bio", bio_text.text);     sql_command.parameters.add(id)     sql_command.parameters.add(last)     sql_command.parameters.add(first)     sql_command.parameters.add(bio)     sql_command.executenonquery(); } catch (exception err) {     response.write(err); } 

the schema table is:

id int not null fname nvarchar(255) lname nvarchar(255) bio nvarchar(max) 

the error message getting result of asp net protecting site against cross site scripting attack. opening of angle bracket looks suspicious, because may injecting malicious javascript or html onto page. question has been answered before @ link: a potentially dangerous request.form value detected client

hope helps !


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -