I am very surprised to see HttpWebRequest has no close method, but its counter-part HttpWebResponse has. It makes me a little bit confused and inconvenient. 🙂
So, we only need to call Close on response and no need to treat with request? My concern is about leaks and better resource usage efficiency. I am using VSTS2008 + C# + .Net 3.5.
Yes, you just need to call it on the response object.
A request does absolutely nothing on its own. It doesn’t open up a socket or something. It just holds some data and you can just ignore it and throw it away if you don’t need it (it’s a pure managed resource and garbage collector will take care of it). Actual stuff happens after one of the
GetResponsemethods is called.