Asp.net mvc 自定义asp.net mvc验证错误消息

Asp.net mvc 自定义asp.net mvc验证错误消息,asp.net-mvc,validation,model-view-controller,Asp.net Mvc,Validation,Model View Controller,我创建了这个模型类: public class test5 { [Required] //when title field empty send from client this is show this messae" The title field is required." public string title { get; set; } public int content { get; set; } } 我希望将必填字段错误消息编辑为自定义消息,并在使用该

我创建了这个模型类:

 public class test5
{
    [Required] //when title field empty send from client this is show this messae" The title field is required."
    public string title { get; set; }
    public int content { get; set; }
}

我希望将必填字段错误消息编辑为自定义消息,并在使用该验证(如
[Required]
任意位置)时显示该错误消息。我如何做到这一点?

在dataanotation中使用keywoard ErrorMessage

public class test5
{
[Required(ErrorMessage = "CUSTOM ERROR MESSAGE")]
    public string title { get; set; }
    public int content { get; set; }
}

有关完整的指南和示例,请参阅。我知道这种方法,但我希望在需要定义的位置中更改需要的默认消息?请在此处查看此项目我希望更改micro soft定义的默认错误消息。