title: MVC 4. ModelState.IsValid always return true
body: <p>I don't understand why ModelState.isValid give me in all the ways. I set something in the email returns true and I pùt empty field, it returns true too. My question ism, what do I have to do to return true when the field is empty and nothing whn I wrote the email?</p>
  
  <p>I have the next view file:</p>
  
  <pre><code>&lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;div style="padding-top:5px;clear:both;"&gt;&lt;/div&gt;
      &lt;% using (Html.BeginForm()) { %&gt;
          &lt;%: Html.ValidationSummary(true) %&gt;   
          &lt;fieldset&gt;
                  &lt;legend&gt;Email usuario&lt;/legend&gt;
  
                  &lt;div class="editor-field"&gt;
                      &lt;%: Html.TextBoxFor(m =&gt; m.Email) %&gt;
                      &lt;%: Html.ValidationMessageFor(m =&gt; m.Email) %&gt;
                  &lt;/div&gt;
  
                  &lt;input type="submit" value="Enviar Email" /&gt;
          &lt;/fieldset&gt;
      &lt;% } %&gt;
      &lt;div style="padding-top:5px;clear:both;"&gt;&lt;/div&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>The Controller is:</p>
  
  <pre><code>//
  // GET: /Account/EmailRequest
  public ActionResult EmailRequest()
  {
      return View();
  }
  
  [HttpPost]
  public ActionResult EmailRequest(string email)
  {
      if (ModelState.IsValid)
      {
          // save to db, for instance
          return RedirectToAction("AnotherAction");
      }
      return View();
  }
  </code></pre>
  
  <p>My model class is:</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.ComponentModel.DataAnnotations;
      using System.Globalization;
      using System.Web.Mvc;
      using System.Web.Security;
  
  namespace PortalClient.Models
  {
      public class EmailRequest
      {
  
          [Required(ErrorMessage = "required")]
          public string Email { get; set; }
      }
  }
  </code></pre>