I have a very strange problem, I programmed an app that triggers a webservice and gives me a response back. This also works on android and IOS (in debug mode) but when I install the app via adhoc it still works but when I press the button that triggers the webservice the app freezes and you have to restart it but it always stops at the same place.
I have found out with a lot of commenting and commenting out that the error happens in the marked place. In debug mode everything works as it should.
Here is the code that will be executed.
IsMYSite(strLink);
if (gotResponse)
{
gotResponse = false;
DetailPage.MYPages.Add(new MYPage { Title = portal, Link = strLink, Username = "", Password = "", IsVisible = false, CompanyImage = ImageLink });
App.Current.Properties["MYPages"] = JsonConvert.SerializeObject(DetailPage.MYPages);
App.Current.Properties["LastPortal"] = strLink;
Navigation.PopAsync(true);
LinkURL.TextColor = Color.Black;
}
else
{
LinkURL.TextColor = Color.Red;
}
public async void IsMYSite(String url)
{
try
{
String linkonly = url;
url += "/api/" + CultureInfo.CurrentUICulture.ThreeLetterWindowsLanguageName;
string strpost = "";
StringContent str = new StringContent(strpost, Encoding.UTF8, "application/x-www-form-urlencoded");
var client = new System.Net.Http.HttpClient();
client.Timeout = new TimeSpan(0, 0, 6);
client.BaseAddress = new Uri(url);
var response = await client.GetAsync(new Uri(url));
Dictionary<string, string> result = JsonConvert.DeserializeObject<Dictionary<string, string>>(response.Content.ReadAsStringAsync().Result);
portal = result["PortalTitle"];
if (result["LoginLogo_Path"].StartsWith("~"))
{
StringBuilder str2 = new StringBuilder(result["LoginLogo_Path"]);
str2.Remove(0, 1);
ImageLink = linkonly + str2.ToString();
gotResponse = true;
}
}
catch
{
}
}