Response.Redirect does not work from Timer_Elapsed
I have an event function, Timer_Elapsed() that executes response.redirect, however, no action is taken when the line of code is executed.
The page load event of this page starts a timer as the last thing it does. I do this because the page must execute a long running query (13 seconds) and I want the page to render itself before the query is kicked off, otherwise the user is looking at a blank screen for 13 seconds before anything is presented. So far tuning the query hasn't yielded acceptable results yet. When the query returns, I store the dataset object in a session variable and redirect to the next page where the results will be rendered for the user's next action.
The application queries an error log table in Oracle to get interface errors for a number of interfaces for easy monitoring of the integrations.
The code looks like this:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
. do initialization stuff here
.
.
StartTimer()
End Sub
Private Sub StartTimer()
Dim Timer1 As System.Timers.Timer = New Timer
Timer1.Interval = 1000
AddHandler Timer1.Elapsed, AddressOf Timer1_Elapsed
Timer1.AutoReset = False
Timer1.Enabled = True
End Sub
Private Sub Timer1_Elapsed(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs)
GetErrorSummary(txtDateFrom.Text, txtDateTo.Text)
Response.Redirect("ErrSummary.aspx", False)
End Sub
Thanks,
Rich
|