Call method when data sent

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NET_NET_2003

    #1

    Call method when data sent

    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
  • NET_NET_2003

    #2
    Re: Call method when data sent

    Hi,
    I don't think that IsClientConnect ed would work, I'll show some code:

    public class ModuleTest : IHttpModule
    {
    public void Init(HttpApplic ation httpApp)
    {
    httpApp.BeginRe quest += new EventHandler(th is.OnBeginReque st);
    httpApp.EndRequ est += new EventHandler(th is.OnEndRequest );
    }
    public void OnBeginRequest( object o, EventArgs ea)
    {
    HttpApplication httpApp = (HttpApplicatio n) o;
    httpApp.Respons e.Write("BeginR equest 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(ob ject o, EventArgs ea)
    {
    HttpApplication httpApp = (HttpApplicatio n) o;
    while(httpApp.R esponse.IsClien tConnected)
    {
    }
    httpApp.Respons e.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


    "Ravikanth[MVP]" <dvravikanth@ho tmail.com> wrote in message news:<0ba801c36 713$fa46f660$a5 01280a@phx.gbl> ...[color=blue]
    > Hi
    >
    > The following example takes action if the client is
    > currently connected.
    > [C#]
    > if (Response.IsCli entConnected == true)
    > {
    > //...
    > }
    >[/color]

    Comment

    • NET_NET_2003

      #3
      Re: Call method when data sent

      any ideas?

      Comment

      Working...