Monday, 1 February 2016

Api call in asp.net desktop application


Api call in asp.net desktop application 

var ApiUrl = ConfigurationManager.AppSettings["ApiUrl"].ToString();//ex http://www.abc.com/
                client.BaseAddress = new Uri(ApiUrl);
                string Email = DataEncryption.Encrypt(txtEmail.Text);
                string Password = DataEncryption.Encrypt(txtPassword.Text);
                string apiKey = "api/UserApi/CheckUserLicense/" + Email + "/" + Password;
                var response = client.GetAsync(apiKey).Result;
                if (response.IsSuccessStatusCode)
                {
                    var responseString = response.Content.ReadAsStringAsync().Result;
                    UserModel model = JsonConvert.DeserializeObject<UserModel>(responseString);
              }

No comments:

Post a Comment