Click here to Skip to main content
15,886,518 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
Sascha Lefèvre12-May-15 14:54
professionalSascha Lefèvre12-May-15 14:54 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
Steve Holdorf12-May-15 15:34
Steve Holdorf12-May-15 15:34 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
Sascha Lefèvre12-May-15 15:44
professionalSascha Lefèvre12-May-15 15:44 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
Stephen Holdorf13-May-15 8:00
Stephen Holdorf13-May-15 8:00 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
Sascha Lefèvre13-May-15 9:53
professionalSascha Lefèvre13-May-15 9:53 
GeneralRe: Improper Neutralization of special elements used in an sql command Pin
PIEBALDconsult12-May-15 11:15
mvePIEBALDconsult12-May-15 11:15 
QuestionSQL Injection error. Pin
Stephen Holdorf12-May-15 9:43
Stephen Holdorf12-May-15 9:43 
AnswerRe: SQL Injection error. Pin
Sascha Lefèvre12-May-15 10:22
professionalSascha Lefèvre12-May-15 10:22 
The way to avoid conventional SQL-injection attacks is to use SQL-parameters. That is, not passing the values for your query as literals concatenated into the SQL-statement but to have the names of SQL-parameters in those places of the SQL-statement instead and add SQL-parameters 'carrying' the actual values to the parameter-collection of the command-object.

E.g. instead of this:
SQL
SELECT col1 FROM table1 WHERE col2 = 'string from user input';

..it should be like this:
SQL
SELECT col1 FROM table1 WHERE col2 = @userinput;

..plus creating an SQL-Parameter with a name of "@userinput", assigning the value 'string from user input' to it and adding it to the parameter-collection of the command-object.

But the posted method is being passed the final query string as an argument, so it's already too late to do this. You will have to change this method
- either to accept an SQL-parameter-collection with the parameters created where the method is being called
- or to accept a value-collection and create SQL-parameters for those values
and then add the SQL-parameters to the command-object. And the calling code obviously has also to be changed accordingly.

http://www.dotnetperls.com/sqlparameter[^]
https://msdn.microsoft.com/en-us/library/system.data.common.dbparameter%28v=vs.110%29.aspx[^]
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

AnswerRe: SQL Injection error. Pin
Richard Deeming13-May-15 1:38
mveRichard Deeming13-May-15 1:38 
GeneralRe: SQL Injection error. Pin
Stephen Holdorf20-May-15 3:24
Stephen Holdorf20-May-15 3:24 
QuestionAuthorize.net PayPal Option Pin
jkirkerx11-May-15 12:24
professionaljkirkerx11-May-15 12:24 
QuestionDashboard samples reference Pin
sma123#11-May-15 5:46
sma123#11-May-15 5:46 
AnswerRe: Dashboard samples reference Pin
User 418025429-Jul-15 10:37
User 418025429-Jul-15 10:37 
Questionunderstand about Web Accessibility Pin
Nguyen Jay8-May-15 15:48
Nguyen Jay8-May-15 15:48 
AnswerRe: understand about Web Accessibility Pin
Richard MacCutchan8-May-15 21:38
mveRichard MacCutchan8-May-15 21:38 
AnswerRe: understand about Web Accessibility Pin
Afzaal Ahmad Zeeshan11-May-15 5:16
professionalAfzaal Ahmad Zeeshan11-May-15 5:16 
QuestionPHP-SOAP: How to authenticate? Pin
Muhammed Özdemir7-May-15 19:23
Muhammed Özdemir7-May-15 19:23 
QuestionRe: PHP-SOAP: How to authenticate? Pin
ZurdoDev11-May-15 4:14
professionalZurdoDev11-May-15 4:14 
QuestionUploading and downloading file from ONEDRIVE through WCF service Pin
Kandepu Rajesh7-May-15 6:32
Kandepu Rajesh7-May-15 6:32 
SuggestionRe: Uploading and downloading file from ONEDRIVE through WCF service Pin
ZurdoDev11-May-15 4:15
professionalZurdoDev11-May-15 4:15 
QuestionHi friends, How to apply bootstrap classes to the particular selected content from textarea. Pin
Member 113964094-May-15 19:45
Member 113964094-May-15 19:45 
AnswerRe: Hi friends, How to apply bootstrap classes to the particular selected content from textarea. Pin
Richard MacCutchan4-May-15 21:14
mveRichard MacCutchan4-May-15 21:14 
GeneralRe: Hi friends, How to apply bootstrap classes to the particular selected content from textarea. Pin
Member 113964094-May-15 22:45
Member 113964094-May-15 22:45 
QuestionAccess a web page through IP and port no (VS2013, HTML5, AngularJS) Pin
Praveen Raghuvanshi4-May-15 7:25
professionalPraveen Raghuvanshi4-May-15 7:25 
Questionabout classic asp Pin
tiwal3-May-15 7:07
tiwal3-May-15 7:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.