title: How to get detailed errors from ModelState asp.net web api identity
body: <p>I have a register form with asp.net web api 2 identity.</p>
  
  <p>This is my register function:</p>
  
  <pre><code>// POST api/Account/Register
      [AllowAnonymous]
      [Route("Register")]
      public async Task&lt;IHttpActionResult&gt; Register(RegisterBindingModel model)
      {
          if (!ModelState.IsValid)
          {
              return BadRequest(ModelState);
          }
  
          var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };
  
          IdentityResult result = await UserManager.CreateAsync(user, model.Password);
  
          if (!result.Succeeded)
          {
              return GetErrorResult(result);
          }
  
          try
          {
              ...send email
          }
          catch (Exception ex)
          {
              throw new Exception(ex.ToString());
          }
          return Ok();
      }
  </code></pre>
  
  <p>If <code>ModelState</code> is not valide it returns something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/XNg6g.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNg6g.png" alt="enter image description here"></a></p>
  
  <p>How can I get this detailed error?
  I'm looking for a way to dynamically get all detailed errors from ModelState.
  I'm not sure if I should do it on the Web api or in javascript when I get the response.</p>