We will update our blogging system model to accommodate the Compare field validation in the View model:
public class LoginViewModel
{
[Required(ErrorMessage = "Username is required")]
public string Username { get; set; }
[Required(ErrorMessage = "Password is required")]
public string Password { get; set; }
[Required(ErrorMessage = "ConfirmPassword is required")]
[Compare("Password", ErrorMessage = "Password does not match")]
public string ConfirmPassword { get; set; }
}
We have looked, exhaustively, at the Compare field validations. Let's explore the Url validation in the next section.