locked
How useful is Response.IsClientConnected? RRS feed

  • Question

  • User944339287 posted

    Hi guys. I have read an article saying that the main usage of Response.IsClientConnected would be for optimizing the delivery of long processes. For example, if i had to generate a huge report or something, you might run the report in a separate thread and then periodically check to see if the user is still connected. If not, you could kill this long-running process so that it is not running needlessly since the user is no longer expecting a response.

    So my question is how can i separate thread and do periodically check in asp.net?

    Dim customer as New DBcustomer
    Dim DT as new DataTable
    
    DT = customer.return_customer("All")
    
    Me.GridView.DataSource = DT.DefaultView
    Me.GridView.DataBind()

    Friday, August 23, 2019 9:38 AM

All replies

  • User475983607 posted

    IMHO, it does not make sense to start another thread if the user is waiting for a response.  You can do the Response.IsClientConnected check in the current thread.

    If you started a new background thread and returned a response, then Response.IsClientConnected is irrelevant.

    Friday, August 23, 2019 10:17 AM