title: Stuck in UploadFromStream when disconnected from internet
body: <p>I have a try/catch method, as shown below.  When the internet connection is down, the code blocks in the try, and does not enter the catch, and the application stops responding. When the internet connection is back, the problem is gone, and everything works fine.</p>
  
  <p>This a part of my code:</p>
  
  <pre><code>using (var fileStream = System.IO.File.OpenRead(strLocatie))
  {
      try
      {
          blobSAS.UploadFromStream(fileStream);
      }
      catch
      {
      }
  }
  </code></pre>
  
  <p>Can I set a timeout such that when the try block takes longer than 1000ms the code automatically goes to the catch?</p>
  
  <p>Whole method:</p>
  
  <pre><code>public void uploadImages(string strLocatie, string naamBestand, string directoryname)
  {
      try
      {
          string dag = DateTime.Now.Day.ToString();
          if (dag.Length == 1)
          {
              string temp = dag;
              dag = "0" + temp;
          }
          string maand = DateTime.Now.Month.ToString();
          if (maand.Length == 1)
          {
              string temp = maand;
              maand = "0" + temp;
          }
          if (signature == null)
          {
              getKey();
          }
          string datum = dag + "-" + maand + "-" + DateTime.Now.Year.ToString();
          CloudBlobClient blobClient = new CloudBlobClient(sUrl, new StorageCredentialsSharedAccessSignature(signature));
          CloudBlobContainer blobContainer = blobClient.GetContainerReference(container1);
          blobContainer.GetDirectoryReference(sUrl + container1);
          CloudBlockBlob blobSAS = new CloudBlockBlob(sUrl + container1 + "/" + directoryname + "/" + datum + "/" + naamBestand,
                          new StorageCredentialsSharedAccessSignature(signature));
          using (var fileStream = System.IO.File.OpenRead(strLocatie))
          {
              try
              {
                  blobSAS.UploadFromStream(fileStream);
              }
              catch
              {
              }
          }
          File.Delete(strLocatie);
      }
      catch
      {
      }
  
  }
  </code></pre>
  
  <p>And if the internet connection is allready down, before starting the application, the catch works perfect...</p>