i am using jQuery in my asp.net mvc site. How can i make sure the use is secure in the sense of protecting against cross site scripting / sql injection attacks?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
jQuery doesn’t play much role in protecting against those kind of attacks. It’s the server side code. For example to protect against SQL injection attacks make sure to always use parametrized queries when querying your database. To protect against XSS make sure you always HTML encode any value that you are outputting in a view.
As far as jQuery is concerned, when sending AJAX requests always use the data hash to pass parameters and avoid string concatenations:
instead of: