iotaSingh iotaSingh - 3 years ago 175
C# Question

Can WebResponse.GetResponseStream() return a null?

i know its a noob question, but just wanted to know whether

can return null in any case?

Answer Source

Well, it's sort of up to the concrete subclass - but I've never seen any subclass which does so, and it's not documented as a valid return value. I've never seen any code written to defensively check for this, and I wouldn't expect to. That's not to say such code doesn't exist, but I don't think it's necessary.

If there's no content in the response (but the response was successful) I'd expect any good implementation to return an empty stream.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download