S
Steve Wright
Hi All,
This is my first time using this interface, so I am sure I am just missing
something stupid. When my Http Handler gets called, the Begin runs and the
delegate runs, but the EndProcessRequest never runs and the page hangs
forever. Any idea why?
Public Class MyAsyncWebHandler
Implements IHttpAsyncHandler
Implements IReadOnlySessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
' not called
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return True
End Get
End Property
' Define the private Async method Delegate
Private Delegate Sub AsyncProcessRequest(ByVal context As HttpContext)
Public Function BeginProcessRequest( _
ByVal context As HttpContext, ByVal cb As AsyncCallback,
ByVal state As Object) _
As IAsyncResult Implements
IHttpAsyncHandler.BeginProcessRequest
Dim dlgt As New AsyncProcessRequest(AddressOf DoMyStuff)
Return dlgt.BeginInvoke(context, Nothing, Nothing)
End Function
Public Sub EndProcessRequest(ByVal ar As IAsyncResult) Implements
IHttpAsyncHandler.EndProcessRequest
Dim dlgt As AsyncProcessRequest = DirectCast(DirectCast(ar,
AsyncResult).AsyncDelegate, AsyncProcessRequest)
dlgt.EndInvoke(ar)
End Sub
Public Sub DoMyStuff(ByVal context As HttpContext)
Threading.Thread.Sleep(3000)
End Sub
End Class
Thanks,
This is my first time using this interface, so I am sure I am just missing
something stupid. When my Http Handler gets called, the Begin runs and the
delegate runs, but the EndProcessRequest never runs and the page hangs
forever. Any idea why?
Public Class MyAsyncWebHandler
Implements IHttpAsyncHandler
Implements IReadOnlySessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
' not called
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return True
End Get
End Property
' Define the private Async method Delegate
Private Delegate Sub AsyncProcessRequest(ByVal context As HttpContext)
Public Function BeginProcessRequest( _
ByVal context As HttpContext, ByVal cb As AsyncCallback,
ByVal state As Object) _
As IAsyncResult Implements
IHttpAsyncHandler.BeginProcessRequest
Dim dlgt As New AsyncProcessRequest(AddressOf DoMyStuff)
Return dlgt.BeginInvoke(context, Nothing, Nothing)
End Function
Public Sub EndProcessRequest(ByVal ar As IAsyncResult) Implements
IHttpAsyncHandler.EndProcessRequest
Dim dlgt As AsyncProcessRequest = DirectCast(DirectCast(ar,
AsyncResult).AsyncDelegate, AsyncProcessRequest)
dlgt.EndInvoke(ar)
End Sub
Public Sub DoMyStuff(ByVal context As HttpContext)
Threading.Thread.Sleep(3000)
End Sub
End Class
Thanks,