title: asp.net mvc ajax post returns 404 not found
body: <p>I'm trying to do an ajax request using jquery ajax function. I have a very strange behaviour. My folder structure ist like this:</p>
  
  <p><img src="https://i.stack.imgur.com/IeFCX.png" alt="folder structure"></p>
  
  <p>My client-side ajax call (in UserManagement/Index.cshtml) looks like the following:</p>
  
  <pre><code>var rolename = viewModel.roleName();
  $.ajax({
       type: "POST",
       url: '@Url.Action("AddRole", "UserManagement")',
       contentType: "application/json; charset=utf-8",
       data: { rolename: rolename },
       success: function(data) {
           var role = new Role(rolename);
           model.addRole(role);
           model.appendItem("#accordion", role.getItem());
           viewModel.roleName("");            
       }
  });
  </code></pre>
  
  <p>In my UserManagementController.cs I have the following actions:</p>
  
  <pre><code>    // GET: /UserManagement/
      public ActionResult Index()
      {
          var serializer = new JavaScriptSerializer();
          var context = new ApplicationDbContext();
          var users = context.Users.ToList();
          var roles = context.Roles.ToList();
  
  
          ViewBag.Users = users;
          ViewBag.Roles = roles;
          return View();
      }
  
      //
      // POST: /UserManagement/AddRole
      [HttpPost]
      public string AddRole(string rolename)
      {
  
          Response.StatusCode = 200;
          return "gsfgdg";
      }
  </code></pre>
  
  <p>I already tried to use a GET instead of POST or to change AddRole to void type and anything other but I can't get this to work. I always receive a "404 not found".
  Can anybody help?</p>
  
  <p>Thanks in advance!</p>