Postasync可以与UWP配合使用,但在android项目中有所突破

时间:2017-05-16 06:50:02

标签: c# xamarin xamarin.forms cross-platform

以下代码用于跨平台解决方案。

 var auth = new SigninModel
            {
                Username = username,
                Password = password
            };

var stringContent = new StringContent(JsonConvert.SerializeObject(auth), Encoding.UTF8, "application/json");

var response = await Client.PostAsync("http://localhost:54019/api/AuthenticationApi/Login", stringContent);

以下是我的网络服务代码

 [System.Web.Http.Route("api/AuthenticationApi/Login/")]
 [System.Web.Http.AcceptVerbs("GET", "POST")]
 [System.Web.Http.HttpPut]   
  public DBResult Login(AuthenticationModel model)
        {
         return new DBResult {}
        }

0 个答案:

没有答案