ASP.NET MVC post method parameter is always nothing (null) -


i'm sending json asp.net mvc sencha touch:

ext.ajax.request({     url: 'http://localhost:52771/api/login',     method: 'post',     headers: {              'content-type': 'application/json'                },           params: {             post: json.stringify({                     user: username,                     pwd: password                 })         },     },     success: function (response) {          var loginresponse = ext.json.decode(response.responsetext);          if (loginresponse === true) {             // server send token can used throughout app confirm user authenticated.             me.sessiontoken = loginresponse.sessiontoken;             me.signinsuccess();     //just simulating success.         } else {             me.signinfailure(loginresponse.message);         }     },     failure: function (response) {         me.sessiontoken = null;         me.signinfailure('login failed. please try again later.');     } }); 

here service code:

   namespace simplesevice public class logincontroller     inherits apicontroller      private shared list ilist(of login1) = new list(of login1)( _               {new login1() {.user = "user", .pwd = "password"}, _                new login1() {.user = "user1", .pwd = "password1"}, _                new login1() {.user = "user2", .pwd = "password2"}                }     )      public function getlogin() ienumerable(of login1)         return list     end function      <system.web.http.httppost> _     public function postlogin(byval login login1) net.http.httpresponsemessage         if login.user = "john" andalso login.pwd = "human"             return request.createresponse(of boolean)(net.httpstatuscode.ok, true)         end if         return request.createresponse(of boolean)(net.httpstatuscode.notfound, false)     end function  end class 

end namespace

here http traffic:

    request url:http://localhost:52771/api/login?_dc=1391752685427 request method:post status code:500 internal server error request headers accept:*/* accept-encoding:gzip,deflate,sdch accept-language:ru-ru,ru;q=0.8,en-us;q=0.6,en;q=0.4 connection:keep-alive content-length:53 content-type:application/json host:localhost:52771 origin:http://localhost:1841 referer:http://localhost:1841/login/ user-agent:mozilla/5.0 (windows nt 6.1) applewebkit/537.36 (khtml, gecko) chrome/32.0.1700.107 safari/537.36 x-requested-with:xmlhttprequest query string parametersview sourceview url encoded _dc:1391752685427 request payload post=%7b%22user%22%3a%22t%22%2c%22pwd%22%3a%22y%22%7d response headers access-control-allow-origin:http://localhost:1841 cache-control:no-cache content-length:900 content-type:application/json; charset=utf-8 date:fri, 07 feb 2014 05:58:18 gmt expires:-1 pragma:no-cache server:microsoft-iis/8.0 x-aspnet-version:4.0.30319 x-powered-by:asp.net x-sourcefiles:=?utf-8?b?rdpcc2vuy2hhxfnpbxbszvnldmljzvxtaw1wbgvtzxzpy2vcyxbpxgxvz2lu?= 

i'm getting login nothing.

asp.net mvc , asp.net web api 2 different frameworks. can sit side side in same project use different set of classes. attributes using on actions in apicontroller mvc namespace, hence not valid.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -