最佳途径prevent SQL注入使用JavaScript或C#? [英] Best Way to Prevent SQL Injection Using Javascript or C#?

查看:120
本文介绍了最佳途径prevent SQL注入使用JavaScript或C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在写它使用AJAX在后端。

I'm currently writing an application which uses ajax on the front end and ASP.NET (C#) on the back end..

一小部分的应用程序并调用Ajax后端code(获得从SQL数据库条目)

A Small Part of the application does an AJAX call to the backend code (to get entries from the SQL database)

如何JScript的注资prevent SQL?

How can i prevent SQL of JScript injection?

我知道这是一般不安全的验证与JavaScript,因为JavaScript可以关闭,但因为这是一个AJAX调用,所以如果用户已关闭JavaScript的AJAX将不会运行。

I know it is generally unsecure to validate with javascript because javascript can be turned off but as this is an AJAX call so if the user has javascript turned off the AJAX will never run.

请告诉我验证或转义输入的最佳方式?

Whats the best way of validating or escaping the input?

像Add_Slashes()在PHP?

Like Add_Slashes() in PHP?

感谢

丹尼尔

推荐答案

使用参数化查询,从不构建SQL code字符串。

Use parametrized queries, never build SQL code strings.

这篇关于最佳途径prevent SQL注入使用JavaScript或C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆