I am trying to redirect to another page on process cancellation (triggered by cancel button).
My progress event is running on separate thread, here is the code:
Public Sub ProgressArea()
Do
Dim dt As DataTable = AdminData.getLogPercent(Session("ProjectID"))
Dim count As Integer = dt.Rows(0)("PercentDone")
Dim message As String = dt.Rows(0)("RecordDesc")
context.SecondaryValue = "Total Progress: " & count.ToString() + "%"
context.SecondaryPercent = count.ToString()
context.CurrentOperationText = message
If Response.IsClientConnected = False Then
Response.Redirect("redirect.aspx")
End If
If count < 98 Then
'calls to itself to repeat
Thread.Sleep(1000)
Else
Exit Do
End If
Loop
End Sub
Code hits the redirect , but nothing happens. However if i redirect without clicking "Cancel" button it does work.
I am completely lost. Any help?
Thank you