- private async void btnLogin_Clicked(object sender, EventArgs e)
-
- try
- {
- EmailConfigDetailsVM emildetails = new EmailConfigDetailsVM();
- HttpClient client = new HttpClient();
- string apiUrl = "http://localhost:52869/api/default/sendmail1?tomail=";
- emildetails.ToRecipients ="*********@gmail.com";
- emildetails.Body ="test";
- emildetails.Subject = "test";
- var serializedProduct = JsonConvert.SerializeObject(emildetails);
- var content = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
- HttpResponseMessage response = client.GetAsync(apiUrl+ "*********@gmail.com").Result;
- if (response.IsSuccessStatusCode)
- {
- DisplayAlert("Alert", "Send Successfully", "OK");
- }
- else
- {
- DisplayAlert("Alert", "Send Failed...", "OK");
- }
- }
- catch (Exception ex)
- {
- string err = ex.InnerException.ToString();
- errormsg.Text = ex.Message.ToString();
- }
it throw an exception in xamrin:
Exception has been thrown by the target of an invocation.Please help me.