我正在使用 EF 4.0 开发 MVC 应用程序。
我正在尝试将值<test>
添加到地址字段,但在保存它时会出现以下错误,如何解决?
从客户端检测到潜在危险的 Request.Form 值 (Address=" <test>
")。
编辑
请检查以下代码
namespace CEntities
{
[MetadataType(typeof(EmployeeMetaData))]
public partial class Employee
{
}
/// <summary>
/// Holds the validations for Employee class
/// </summary>
public class EmployeeMetaData
{
[Key]
public int Id { get; set; }
[Required]
[StringLength(50, ErrorMessage = "First name can accept maximum 50 characters.")]
public string FirstName { get; set; }
[StringLength(50, ErrorMessage = "Last name can accept maximum 50 characters.")]
public string LastName { get; set; }
[StringLength(1000, ErrorMessage = "Address can accept maximum 1000 characters.")]
public string Address { get; set; }
}
}