Data annotations not working in ASP.NET Core
<p>I have written the following code in my cs.html file, but it's not showing any error if the fields are left empty. Any help please?</p>

<pre><code>&lt;form method="post" action="/Demo/RegisterInput"&gt;
    Email:
    &lt;input type="email" data-val="true"
           data-val-email="The Email Address field is not a valid e-mail address."
           data-val-required="The Email Address field is required."
           id="Email" name="Email" value="" /&gt; &lt;br&gt;
    Password:
    &lt;input type="password" data-val="true"
           data-val-required="The Password field is required."
           id="Password" name="Password" /&gt;&lt;br&gt;
    &lt;button type="submit"&gt;Register&lt;/button&gt;
  &lt;input name="__RequestVerificationToken" type="hidden" value="&lt;removed for brevity&gt;" /&gt;
&lt;/form&gt;
</code></pre>

<p>And following is my model:</p>

<pre><code>using System.ComponentModel.DataAnnotations;

namespace FormsTagHelper.ViewModels
{
    public class RegisterViewModel
    {
        [Required]
        [EmailAddress]
        [Display(Name = "Email Address")]
        public string Email { get; set; }

        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }
    }
}
</code></pre>