With our ASP.NET application, sometimes we may have to process time consuming queries like database transaction, payment gateway integration, time out, etc... In such situations we have to check the client connection is still alive or not. Coz there is a gap between client request time and server response time.
So, we better to check the client connection status after running complex / time consuming process. Otherwise, server unnecessarily keeps the client’s response and it affects to the server performances.
With ASP.NET you can do it simply like below.
FYI: IsClientConnected is a read only property. If IsClientConnected is true, that means client has live connection with the server. If IsClientConnected is false then you can release the server by ending the client response.
Source code: IsClientConnected.zip
Labels: ASP.NET, ASPX