Returning value from resful webapi and redirecting to another page - problem
I am returning a response from a restful api and passing on returned value to another webapi. Following is code private async void ButtonLogin_Clicked(object sender, EventArgs e) { var result = SendSMS.SendOTP(TxtMobileNo.Text); //Line 1 OTP_Session = ((SMSResponse)result.Result).Details.ToString(); // Line 2 await Shell.Current.GoToAsync($"otpverification?mobileno={TxtMobileNo.Text}&otpsession={OTP_Session}"); /Line 3 } Code in the line 3 is not getting executed... i dont know whats the problem. Anyone can please help where i am wrong. Following is the SendOTP Function public static async Task<SMSResponse> SendOTP(string mobileNo) { string webserviceurl = "https://abc.in/API/V1/" + api_key + "/SMS/" + mobileNo + "/AUTOGEN"; var httpclient = new HttpClient(); var json = JsonConvert.SerializeObject(mobileNo); HttpContent httpContent = new StringContent(json); httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response = await httpclient.PostAsync(webserviceurl, httpContent); HttpContent responseContent = response.Content; string result = await response.Content.ReadAsStringAsync(); SMSResponse objSMSResponse = new SMSResponse(); using (var reader = new System.IO.StreamReader(await responseContent.ReadAsStreamAsync())) { var content = await response.Content.ReadAsStringAsync(); objSMSResponse = JsonConvert.DeserializeObject<SMSResponse>(content); } return await Task.FromResult( objSMSResponse); } Following is SMSResponse Class public class SMSResponse { public string Status { get; set; } public string Details { get; set; } }