Call method when data sent

  • Thread starter Thread starter NET_NET_2003
  • Start date Start date
N

NET_NET_2003

Hi,
I have programmed a module, but I have a small problem. I need to call
a method but after the data has been sent to the client (or when the
client is disconnected).
Which event can I use? and is this possible?

Thanx
 
Hi,
I don't think that IsClientConnected would work, I'll show some code:

public class ModuleTest : IHttpModule
{
public void Init(HttpApplication httpApp)
{
httpApp.BeginRequest += new EventHandler(this.OnBeginRequest);
httpApp.EndRequest += new EventHandler(this.OnEndRequest);
}
public void OnBeginRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
httpApp.Response.Write("BeginRequest started <br/>");
//and may perform also something else
}
//After the data has been sent to client,
//I want to call a specific method.
//The event EndRequest will be fired when the worker
//process has finished his job,
//and doesn't mean that the client has received data.
//So I tried the following:
public void OnEndRequest(object o, EventArgs ea)
{
HttpApplication httpApp = (HttpApplication) o;
while(httpApp.Response.IsClientConnected)
{
}
httpApp.Response.Write("Client is no more connected<br/>");
}
}
But this did not work, it never returns :(
I hope that somebody would be able to help

Thanx
 
Back
Top