You can use HttpResponse’s IsClientConnected property to figure out if the connection is still alive. Based on the value, you can kill a long-running process if the client is not connected or redirect to a different page, etc.
if (Response.IsClientConnected){}else{}