i have following controller in angularjs,
var user = { username: $scope.username, password: $scope.password }; var promisepost = loginservice.post(user); promisepost.then(function (result) { var res = result.data; //todo: set permissions },
this links service,
this.post = function (user) { return $http.post(toapiurl('login'), user); }
and in api controller have following,
[system.web.http.httppost] public ihttpactionresult post(userlogin user) { if (modelstate.isvalid) { // validate specified credentials var validationresult = this.validateuser(user.username, user.password); if (validationresult.isauthenticated) { formsauthentication.setauthcookie(user.username, false); return ok(); } } return unauthorized(); }
my issue never returns var res = result.data in javascript. if make api method empty (and change void) reach line in debugger, going wrong in api method. reaching actual return ok line, not going properly. ideas.?
Comments
Post a Comment