我试图将Asp.Net WebApi方法称为:
[HttpPost]
[ActionName("Login2")]
public bool Login(UserInfo userinfo)
{
return userinfo.Username == "sandeep@sa.com" && userinfo.Password == "chandra";
}
从Restangular代码看起来像:
var lUserInfo = { Username: this.fEmail, Password: this.fPassword };
this.fLoginService.withConfig(x => x.setDefaultHeaders({ 'Content-Type': 'application/json' }))
.all("v1Values").post("Login2", null,
{ userinfo: lUserInfo }).then(
x => {
var lLoggedIn: boolean = x == "true";
this.fSessionService.fUserAuthenticated = lLoggedIn;
if (lLoggedIn) {
this.fLocation.path('/dashboard');
return;
}
Utilities.Dialog.showError('Invalid Email or Password');
});
我收到此错误:
"OPTIONS http://myserver:7220/api/v1Values 500 (Internal Server Error)"
我无法让它发挥作用。我无法看到身体中传递的userinfo。
我做错了什么?