csharp: added request timeout for download

This commit is contained in:
Vladimir Kurguzov
2022-11-11 12:23:28 +03:00
committed by Sergey Linnik
parent 13e243f900
commit 106d9bfed3

View File

@ -324,6 +324,7 @@ namespace OnlineEditorsExample
if (string.IsNullOrEmpty(path)) throw new ArgumentException("path"); // file isn't specified
var req = (HttpWebRequest)WebRequest.Create(url);
req.Timeout = 5000;
using (var stream = req.GetResponse().GetResponseStream()) // get input stream of the file information from the url
{
if (stream == null) throw new Exception("stream is null");