I've a controller with authorize attribute where i do stuff like login, logout. After a succued login action with a javascript call, all other actions still returning 401 Unauthorized error. In my example using the logout action returning 401 and leads to my problem.
Actions
[HttpGet]
[AllowAnonymous]
[Mvc.ValidateAntiForgeryToken]
public bool Login(string param)
{
    var parameters = param.Split('/');
    var username = parameters[0];
    var password = parameters[1];
    if (WebSecurity.Login(username, password, true))
        return true;
    return false;
}
[HttpGet]
[Mvc.ValidateAntiForgeryToken]
public void Logout()
{
    WebSecurity.Logout();
}
Ajax
public login(username: string, password: string): bool {
    var url = this.baseUrl + "Account/Login/" +
        encodeURIComponent(username) + "/" + encodeURIComponent(password);
    var xhr: JQueryXHR = $.ajax({
        type: "GET",
        url: url,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        async: false,
        cache: false
    });
    if (xhr.status == 200)
        if (xhr.responseText == "true")
            return true;
    return false;
}
public logout(): bool {
    var url = this.baseUrl + "Account/Logout/";
    var deferred: JQueryDeferred = $.Deferred();
    var xhr = $.ajax({
        type: "GET",
        url: url,
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        cache: false,
        async: false
    });
    if (xhr.status == 200)
        return true;
    return false;
}
