asp.net-mvc-5 – “确认密码”和“密码”不匹配. MVC5

我无法本地化验证:“确认密码”和“密码”不匹配.在MVC5
[required]
        [StringLength(100,ErrorMessage = "The {0} must be at least {2} characters long.",MinimumLength = 6)]
        [DataType(DataType.Password)]
        [display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [display(Name = "Confirm password")]
        [Compare("Password",ErrorMessage = "The password and confirmation password do not match.")] //Why not display this message???????
        public string ConfirmPassword { get; set; }

请帮我把它本地化

解决方法

你有两个选择可以解决这个bug:

– 选项1

更改:

[Compare("Password",ErrorMessage = "The password and confirmation password do not match.")]

[System.Web.Mvc.Compare("Password",ErrorMessage = "Your custom error message")]

– 选择2(我推荐这个)

我们需要更新我们的ASP.NET MVC 5.在Visual Studio中,转到Package Manager Console并键入:

PM> update-package

你得到一个错误在:

public ApplicationDbContext()
            : base("DefaultConnection")
        {
        }

错误是由MVC 5的内部结构的更新引起的.要解决这个错误,请执行以下操作:https://stackoverflow.com/a/23090099/2958543

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....