The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WebClientExtension.cs 730B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Web;
  6. namespace Teknik.Helpers
  7. {
  8. public class WebDownload : WebClient
  9. {
  10. /// <summary>
  11. /// Time in milliseconds
  12. /// </summary>
  13. public int Timeout { get; set; }
  14. public WebDownload() : this(60000) { }
  15. public WebDownload(int timeout)
  16. {
  17. this.Timeout = timeout;
  18. }
  19. protected override WebRequest GetWebRequest(Uri address)
  20. {
  21. var request = base.GetWebRequest(address);
  22. if (request != null)
  23. {
  24. request.Timeout = this.Timeout;
  25. }
  26. return request;
  27. }
  28. }
  29. }