N
NET_NET_2003
Hi,
I have a DLL that does something with the network interface. When My
Web Service receives a request, a function of this DLL will be called,
and after the data has been sent to the client, another function will
be called. So it is important to know, when the data has been already
sent.
For the first situation it is not a problem bec a request will be
received, but the problem is in the second case
So I thought, an HttpModule may help, and here is some code:
---------------
Global.asax
---------------
<%@ Application Codebehind="Global.asax.cs" Inherits="ModuleWS.Global"
%>
-------------------
Global.asax.cs
-------------------
protected void Application_EndRequest(Object sender, EventArgs e)
{
HttpApplication httpApp = (HttpApplication) sender;
httpApp.Response.Flush();
//while(httpApp.Response.IsClientConnected)
//the client is always connected until it gets all traffic,
// that is logical, so this will not return
while(httpApp.Response.OutputStream.Length > 0)
{
//System.Threading.Thread.Sleep(20);
}
}
-------------------------------------------------------------------------------
when I include this, the client will break down, bec. it doesn't
receive any answer. Any ideas??? even when u have another solution, I
need a way that tells me that the WebService has sent the data to the
client.
Thanx
I have a DLL that does something with the network interface. When My
Web Service receives a request, a function of this DLL will be called,
and after the data has been sent to the client, another function will
be called. So it is important to know, when the data has been already
sent.
For the first situation it is not a problem bec a request will be
received, but the problem is in the second case
So I thought, an HttpModule may help, and here is some code:
---------------
Global.asax
---------------
<%@ Application Codebehind="Global.asax.cs" Inherits="ModuleWS.Global"
%>
-------------------
Global.asax.cs
-------------------
protected void Application_EndRequest(Object sender, EventArgs e)
{
HttpApplication httpApp = (HttpApplication) sender;
httpApp.Response.Flush();
//while(httpApp.Response.IsClientConnected)
//the client is always connected until it gets all traffic,
// that is logical, so this will not return
while(httpApp.Response.OutputStream.Length > 0)
{
//System.Threading.Thread.Sleep(20);
}
}
-------------------------------------------------------------------------------
when I include this, the client will break down, bec. it doesn't
receive any answer. Any ideas??? even when u have another solution, I
need a way that tells me that the WebService has sent the data to the
client.
Thanx