Answers for "timeout in httpclient c#"

C#
1

set request timeout c#

<system.web>
     <httpRuntime executionTimeout="600"/>
 </system.web>
Posted by: Guest on August-29-2020
0

WebClient timeout

private class WebClient : System.Net.WebClient
    {
        public int Timeout { get; set; }

        protected override WebRequest GetWebRequest(Uri uri)
        {
            WebRequest lWebRequest = base.GetWebRequest(uri);
            lWebRequest.Timeout = Timeout;
            ((HttpWebRequest)lWebRequest).ReadWriteTimeout = Timeout;
            return lWebRequest;
        }
    }

    private string GetRequest(string aURL)
    {
        using (var lWebClient = new WebClient())
        {
            lWebClient.Timeout = 600 * 60 * 1000;
            return lWebClient.DownloadString(aURL);
        }
    }
Posted by: Guest on May-31-2020

Code answers related to "timeout in httpclient c#"

C# Answers by Framework

Browse Popular Code Answers by Language