Search code examples
c#.net-coresystem.net

HttpWebRequest .Net Core set Timeout


I am trying to set the Timeout on an HttpWebRequest and it seems that it is not possible in .Net Core. The property 'Timeout' is no longer there.

Thanks


Solution

  • I am trying to set the Timeout on an HttpWebRequest and it seems that it is not possible in .Net Core.

    It is possible in .NET Core if you are using .NET Core 2.0. You can see the support for the Timeout property here.

    enter image description here

    If you can, use the System.Net.Http.HttpClient instead, because...

    In general, for better app performance and features, we recommend developers move away from HttpWebRequest and adopt HttpClient API surface.