HttpWebRequest: The request was aborted: The request was canceled.

Posted by Emeka on Stack Overflow See other posts from Stack Overflow or by Emeka
Published on 2010-03-17T00:51:25Z Indexed on 2010/06/01 23:33 UTC
Read the original article Hit count: 521

I've been working on developing a middle man application of sorts, which uploads text to a CMS backend using HTTP post requests for a series of dates (usually 7 at a time). I am using HttpWebRequest to accomplish this. It seems to work fine for the first date, but when it starts the second date I get the System.Net.WebException: The request was aborted: The request was canceled.

I've searched around and found the following big clues:

http://social.msdn.microsoft.com/Forums/en-US/netfxnetcom/thread/0d0afe40-c62a-4089-9d8b-fb4d206434dc

http://www.jaxidian.org/update/2007/05/05/8

http://arnosoftwaredev.blogspot.com/2006/09/net-20-httpwebrequestkeepalive-and.html

And they haven't been too helpful. I've tried overloading the GetWebReuqest but that doesn't make sense because I don't make any use of that function.

Here is my code: http://pastebin.org/115268

I get the error on line 245 after it has run successfully at least once.

I'd appreciate any help I can get as this is the last step in a project I've been working on for sometime. This is my first C#/VS project so I'm open to any tips but I would like to focus on getting this problem solved first.

THanks!

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms