Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. WebClient timeout error
  2. public class WebDownload : WebClient
  3. {
  4.     private int _timeout;
  5.     /// <summary>
  6.     /// Time in milliseconds
  7.     /// </summary>
  8.     public int Timeout
  9.     {
  10.         get
  11.         {
  12.             return _timeout;
  13.         }
  14.         set
  15.         {
  16.             _timeout = value;
  17.         }
  18.     }
  19.  
  20.     public WebDownload()
  21.     {
  22.         this._timeout = -1;
  23.     }
  24.  
  25.     protected override WebRequest GetWebRequest(Uri address)
  26.     {
  27.         WebRequest result = base.GetWebRequest(address);
  28.         result.Timeout = this._timeout;
  29.         return result;
  30.     }
  31. }