I am attempting to read some data off of a server for a built in update function and I am getting a compile time error. Is there any way I can get around this? I need this to check if the user has a working internet connection and if not skip the update check. (Unless there are more reliable ways in .Net 4.5)
WebClient client = new WebClient();
try
{
Stream stream = client.OpenRead("http://repo.itechy21.com/updatematerial.txt");
}
catch (Exception ex)
{ MessageBox.Show(ex.Message); }
StreamReader reader = new StreamReader(stream); // <-- error here
String content = reader.ReadLine();
Error:
stream does not exist in the current context