title: Ajax call to JsonResult in Controller fails with 404 error, "resource not found"
body: <p>Here is my ajax code in my "ManageUserRoles.cshtml":</p>
  
  <pre><code>//HIT THE DATABASE FOR USERNAME GIVING IT THIS USERNAME
  function isUserValid(thisUser) {
  
  
      $.ajax({
          url: "/Roles/isUserValid/" + thisUser,
          type: 'POST',
          success: handleResultResponseUserName,
          error: function (xhr) { alert("Error..."); }
      });
  }
  
  
  //handles data back from ajax call
  //RESET INPUT IF NO USER IF FOUND IN USER'S TABLE
  function handleResultResponseUserName(ResponseObject) {
  
      if (ResponseObject == "no user with this number") {
  
          $('#frmGetRoles').find('input[name="UserName"]').val(null);
  
      }
      else {
  
          //DO NOTHING
  
      }
  
  }
  </code></pre>
  
  <p>Here is my JsonResult in my RolesController:</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public JsonResult isUserValid(string username)
  {
      var name = string.Empty;
  
      var CheckUserExists = (from c in _db.AspNetUsers
                         where (c.UserName.Equals(username))
                         select c);
  
  
      var results = new JsonResult();
  
      if (CheckUserExists.Any())
      {
  
          name = CheckUserExists.First().UserName;
  
      }
  
      else
      {
          name = "no user with this name in database";
  
      }
      return Json(name, JsonRequestBehavior.DenyGet); 
  }
  </code></pre>
  
  <p>I've got almost exact code working in a different application and I cut and pasted into a new one where I am trying to use it for Roles management.</p>
  
  <p>The json reference is there, and in web.config. But when I put a breakpoint inside the JsonResult, it never stops there and an error is returned from the client javascript (404 resource not found). There is no other json stuff being used in this new app . . .yet.</p>
  
  <p>I can hit f5 and it returns:
  <a href="http://localhost/StoreMasterSecure/Roles/ManageUserRoles" rel="nofollow">http://localhost/StoreMasterSecure/Roles/ManageUserRoles</a> 
  which is the view that has the button that runs the ajax. It all gets to the ajax call and then nothing happens and Chrome Developer Tools console shows 404 error.</p>
  
  <p>Even if I type in the URL the path, I get the resource not found 404 page:
  <a href="http://localhost/StoreMaster/Roles/isValidUser/xxxx@xxx.com" rel="nofollow">http://localhost/StoreMaster/Roles/isValidUser/xxxx@xxx.com</a></p>
  
  <p>(isValidUser is the JsonResult in the controller, in same controller that ManageUserRoles ActionResult exists and works)</p>