Your code works as expected for me. When you call Abort() on a pending request, your ReadCallback is expected to fire. Then when you call EndGetResponse() you should get a WebException with Status=RequestCanceled Try this slightly modified code to see this in action: private void ReadCallback(IAsyncResult asynchronousResult) { _stopTimer = true; HttpWebRequest request = (HttpWebRequest)asynchronousResult.
AsyncState; try { var m_response = (HttpWebResponse)request. EndGetResponse(asynchronousResult); System.Diagnostics.Debug. WriteLine("Success"); } catch (WebException exc) { System.Diagnostics.Debug.
WriteLine(exc. Status); } } See also on MSDN: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.abort(v=VS.95).aspx The Abort method cancels a request to a resource. After a request is canceled, calling the BeginGetResponse, EndGetResponse, BeginGetRequestStream, or EndGetRequestStream method causes a WebException with the Status property set to RequestCanceled.
Your code works as expected for me. When you call Abort() on a pending request, your ReadCallback is expected to fire. Then when you call EndGetResponse() you should get a WebException with Status=RequestCanceled.
Try this slightly modified code to see this in action: private void ReadCallback(IAsyncResult asynchronousResult) { _stopTimer = true; HttpWebRequest request = (HttpWebRequest)asynchronousResult. AsyncState; try { var m_response = (HttpWebResponse)request. EndGetResponse(asynchronousResult); System.Diagnostics.Debug.
WriteLine("Success"); } catch (WebException exc) { System.Diagnostics.Debug. WriteLine(exc. Status); } } See also on MSDN: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.abort(v=VS.95).aspx "The Abort method cancels a request to a resource.
After a request is canceled, calling the BeginGetResponse, EndGetResponse, BeginGetRequestStream, or EndGetRequestStream method causes a WebException with the Status property set to RequestCanceled.
Thanks, it works now. – user693080 Apr 6 at 14:32.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.