How to set a Timeout for HttpWebRequest (WebRequest)? (it's no more) RRS feed

  • Question

  • .Timeout property is gone, how can we set one?

    Basically, i want it to .Abort() internally automatically if it can't succeed in completing the request in X seconds.

    Wednesday, April 25, 2012 2:13 PM


  • Hi,

    you can use HttpClient instead of HttpWebRequest. It has a Timeout property (in milliseconds) and it's a lot simpler to use with GetAsync and PostAsync methods.

    Wednesday, April 25, 2012 3:14 PM