public async Task <CustomerResponse> AuthencateUser(string Email, string CardId, string uid) { sw.Start(); CustomerResponse output = null; try { var uri = new Uri(ServiceURL + "AuthenticateUserBeta/" + CardId + "/email/" + Email + "/DeviceId/" + uid); var byteArray = new UTF8Encoding().GetBytes(CardId + ":password"); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var response = await client.GetAsync(uri).ConfigureAwait(false); if (response.IsSuccessStatusCode) { string Token = response.RequestMessage.Headers.Authorization.Parameter; CurrentUser.SaveAuthToken(Token); output = JsonConvert.DeserializeObject <CustomerResponse>(response.Content.ReadAsStringAsync().Result); //var response = await client.GetStringAsync(uri).ConfigureAwait(false); output = JsonConvert.DeserializeObject <CustomerResponse>(response.Content.ReadAsStringAsync().Result); } } catch (Exception ex) { LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace); } sw.Stop(); LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "Authencate Card and sending mail"); //Console.WriteLine("Authencate Card and sending mail service Time Elapsed"+sw.Elapsed.TotalSeconds); return(output); }