Login Action Method:
public ActionResult Login(Login loginForm, string returnUrl) {if (!ModelState.IsValid) return View("Login");var Password = Md5Hash.Encrypt(loginForm.Password);var user = (from users in _dbContextModel.user_login where ((users.login_id == loginForm.Login_id) && (users.password == Password)) select users).FirstOrDefault(); if (user != null) { UserLogin userLogin = user;userLogin.last_login = DateTime.Now; // userLogin.password = user.password; _dbContextModel.Entry(userLogin).State = EntityState.Modified; _dbContextModel.SaveChanges();Model Class:
[RegularExpression(@"^(?=*[A-Z])(?=*[a-z])(?=*[0-9])[A-Za-z0-9]{8,}$", ErrorMessage = "invalid")] [Required(ErrorMessage = "Required")] [StringLength(65)] [Display(Name = "Password")] // [RegularExpression(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$", ErrorMessage = "Password contains invalid characters")] //[DataType(DataType.Password)] public string password { get; set; }When i am using above regular expression, i am facing the following run-time exception why? please give me solution. I am using linq, E.F6 and MVC5 using VS015 and .net framework 4.5.

Joginder BangerPosted Jul 31, 2016, 1:13 AM
No code change required:
While you are in debug mode within the
catch {...}block open up the "QuickWatch" window (Ctrl+Alt+Q) and paste in there:or:
If you are not in a try/catch or don't have access to the exception object.
This will allow you to drill down into the
ValidationErrorstree. It's the easiest way I've found to get instant insight into these errors.