控制SQL注入的MVC [英] Control SQL injection in MVC

查看:216
本文介绍了控制SQL注入的MVC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次使用MVC开发,我想,以确保安全。

It's my first time developing using MVC and I want to make it secure.

当我使用HtmlEn code将其字符串转换为等效的HTML字符串。

When I use HtmlEncode it converts the String to the equivalent HTML String.

,用户可以在搜索例如阿里'或ali--输入和他们在我的数据库存在。如何控制我的搜索和SQL注入登录吗?

The user can enter in the search for example ali' or ali-- and they exist in my database. How to control my search and login from SQL injection please?

此外的任何教程或最佳实践prevent脚本注入?

Also any tutorial or best practice to prevent script injection?

推荐答案

LINQ和Entity Framework已经检查SQL注入你。

LINQ and Entity Framework already check for SQL Injection for you.

但是,你应该无论如何阅读文档:

But you should read the documentation anyhow:

链接(节SQL注入攻击)

LINQ MSDN Link (section SQL-Injection Attacks)

实体框架 MSDN链接(用于查询部分的安全注意事项)

Entity Framework MSDN Link (section Security Considerations for Queries)

希望它帮助!

这篇关于控制SQL注入的MVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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