【发布时间】:2014-08-29 05:47:40
【问题描述】:
我正在使用 ASP.Net MVC 4 并像这样创建模型和验证
[Required]
[Display(Name = "Full Name")]
[StringLength(50)]
[RegularExpression("^[a-zA-Z0-9 -']+$", ErrorMessage = "Invalid {0}")]
public String FullName { get; set; }
它在 clint 端正确验证。
我已经在检查了
if(!ModelState.IsValid)
return View(Model);
但是在使用 IBM AppScan 进行验证时,它会像 John' or 1 = 1 -- 这样直接发布数据,并显示 Blind Sql Injection 问题。
调试代码并尝试将全名值更改为John' or 1 = 1 --,ModelState 仍然显示有效。
我想在控制器中验证模型正则表达式,有什么方法可以在控制器中验证它吗?
【问题讨论】:
标签: asp.net-mvc-4