I have a page that makes an HTTPWebRequest to an external system. The external page processes the request and fires some events on its side. I get the "The underlying connection was closed: An unexpected error occurred on a receive." error when the events are fired. If I remove the events from the page, everything works fine. I am thinking I may have an issue with the code in the event (I can't find anything yet), but I wanted to see if there is something I may be missing. Thanks
Daniel
Update 02/11/2010 9:56am: There are no errors on the events. They are working fine. Here is the code I am using to make the request:
Dim req As HttpWebRequest = WebRequest.Create(url & "?" & _requestLength & "&isForward=1&rawResponse=" & RawResponse)
req.ProtocolVersion = New System.Version("1.0")
req.KeepAlive = False
Dim resp As HttpWebResponse = req.GetResponse()
'....log some of the response items.
resp.Close()
Someone had mentioned to set the HTTP version to 1.0 and the keepAlive to false, but that didn't work.
I am calling a standard ASPX page in the request. In that page's code behind is a class that processes the request. The class has some events that I have wired up up in the page. HEre is an example:
Partial Class RequestRedirect
Inherits System.Web.UI.Page
Private WithEvents theEvent As ClassEvents = Nothing
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
dim listener as new RequestListener(Request.Url.Query)
theEvent = listener.ClassEvents
listener.ProcessRequest()
End Sub
Protected Sub ProfileCreated(ByVal prq As ProfileRequest) Handles theEvent.Profile_CreatedEvent
dataAdapter.profileCreated(prq)
End Sub
End Class