locked
When will we possibly get "HttpStatusCode.RequestTimeout"? RRS feed

  • Question

  • Assume our request.Timeout = 1 and HttpWebResponse response = null;

    When we call response = (HttpWebResponse)request.GetResponse(); It will certainly throw an exception timeout. Which remains the response null. And we will never be able to see (response.StatusCode == HttpStatusCode.RequestTimeout).

    By the way, this exception is very special because it will call a MessageBox and tell you timeout in you local language. I am curious  why microsoft design it this way.
    Monday, May 23, 2016 9:28 PM

Answers

  • Hi TruffleWorm,

    >>if a status is always unobservable unless you manually set it, what's its design's reasonability?

    The official document is saying that the reason of this issue due to:

    “RequestTimeout Equivalent to HTTP status 408. RequestTimeout indicates that the client did not send a request within the time the server was expecting the request.”

    So we cannot say that if it is hard to get, then the status will not be designed. After all, the time out status exist and we are able to get it.

    I think you can build a server yourself and set a timeout, then maybe it will be much easier for you to get this timeout state.

    Best regards,

    Moonlight


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, May 27, 2016 8:33 AM

All replies

  • Hi TruffleWorm,
    >>And we will never be able to see (response.StatusCode == HttpStatusCode.RequestTimeout).
    If you want to get or set the 'timeout', you could try to use HttpWebRequest.Timeout property.

    If you try to fix this error, perhaps you could take a look at the link below:
    Adjusting HttpWebRequest Connection Timeout in C#

    Regards,
    Moonlight


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, May 24, 2016 1:42 AM
  • That's not what I meant. I meant, if a status is always unobservable unless you manually set it, what's its design's reasonability?
    Wednesday, May 25, 2016 9:35 PM
  • Hi TruffleWorm,

    >>if a status is always unobservable unless you manually set it, what's its design's reasonability?

    The official document is saying that the reason of this issue due to:

    “RequestTimeout Equivalent to HTTP status 408. RequestTimeout indicates that the client did not send a request within the time the server was expecting the request.”

    So we cannot say that if it is hard to get, then the status will not be designed. After all, the time out status exist and we are able to get it.

    I think you can build a server yourself and set a timeout, then maybe it will be much easier for you to get this timeout state.

    Best regards,

    Moonlight


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, May 27, 2016 8:33 AM