23 Nisan 2016 Cumartesi

c# webclient timeout ekleme

public class WebClientEx : WebClient
 {
     public int Timeout {get; set;}

     protected override WebRequest GetWebRequest(Uri address)
     {
        var request = base.GetWebRequest(address);
        request.Timeout = Timeout;
        return request;
     }
 }
Usage:
 var myClient = new WebClientEx();
 myClient.Timeout = 900000 // Daft timeout period
 myClient.UploadData(myUri, myData);

artık ürettiğiniz metodu kullanıcaksınız webclientEx olucak yani ..