here was my ajax call:
$J.ajax({
type: 'POST',
url: "/ajax/getCharts",
data: JSON.stringify(cids),
dataType: 'json',
asynch: false
})
this worked ... until yesterday
we are using Microsoft.AspNet.Identity;
and yesterday I added in more user roles expanding upon the defaults such as "admin", "user" etc.
Now I am getting this err back in my ajax.fail header:
X-Responded-JSON: {"status":401,"headers":{"location":"http://localhost:56970/Account/Login?ReturnUrl=%2Fajax%2FgetCharts"}}
which kind of makes sense - if the call is failing authentication
note:
in my ajaxController I had previously annotated it as such (which worked):
[Authorize(Roles = "User")]
public class ajaxController : BaseController
and now I expanded it include my new custom user roles such that:
[Authorize(Roles = "Superuser, Poweruser, User")]
public class ajaxController : BaseController
and that didnt work
also i added this in RegisterRoutes:
var settings = new FriendlyUrlSettings();
settings.AutoRedirectMode = RedirectMode.Off;
routes.EnableFriendlyUrls(settings);
as suggested by:
ASP.NET Calling WebMethod with jQuery AJAX "401 (Unauthorized)"
but it didnt work
and this page made no sense to me:
jquery $.ajax call results in 401 unauthorized response when in Chrome or Firefox, but works in IE
what am i missing here?