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 661B

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