Jean-Philippe Berger
Jean-Philippe Berger

Reputation: 35

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

Upvotes: 2

Views: 2298

Answers (1)

Shaun Luttin
Shaun Luttin

Reputation: 141572

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.

Upvotes: 3

Related Questions