Handling exception with uploadvaluesasync
<p>I wanted to know how can I handle exception while the internet connection is offline in this code:</p>

<pre><code>private void LoginDialog_myOnLoginComplete(object sender, OnLoginEventArgs e)
    {
        WebClient client = new WebClient();
            Uri uri = new Uri(server);
            NameValueCollection parameters = new NameValueCollection();

            parameters.Add("Email", e.Email);
            parameters.Add("Password", e.Password);
            client.UploadValuesCompleted += Client_UploadValuesCompleted;

            try
            {
                client.UploadValuesAsync(uri, parameters);
            }
            catch (Exception)
            {
            }
     }

 private void Client_UploadValuesCompleted(object sender, UploadValuesCompletedEventArgs e)
    {
        string complete = Encoding.UTF8.GetString(e.Result);
    }
</code></pre>

<p>When internet connection is down string complete handle the exception and my app crashes. How can I avoid that?</p>