HttpWebRequest web;
try
{
web = (HttpWebRequest)HttpWebRequest.Create("website.name");
WebResponse Response = web.GetResponse();
Stream WebStream = Response.GetResponseStream();
StreamReader Reader = new StreamReader(WebStream);
string data = Reader.ReadToEnd();
Reader.Close();
WebStream.Close();
Response.Close();
string[] ver = Regex.Split(data, "version=");
if (int.Parse(ver[1]) == int.Parse(appVersion))
{
tss1.Text = "Status : You currently have the latest version";
}
else
{
tss1.Text ="Status : A new version of app is available.";
System.Diagnostics.Process.Start("website.name");
}
}
catch (Exception ex)
{
tss1.Text = "Status : Update check failed.";
Debug.Write(ex.ToString());
}
I'm trying to use the above code to connect to webpage and pull down the latest version number for the app which it does just fine. My problem comes in when trying to compare the number found on the webpage to number provided by
appVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();