Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > ASP CDO
|
ASP CDO As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP CDO section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 5th, 2005, 05:54 PM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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
 
Old January 5th, 2005, 09:05 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

You might want the timer function in javascript and not in the code-behind ... as the server has no way of starting a client interaction.

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 7th, 2005, 02:01 AM
Registered User
 
Join Date: Jan 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Vadivel!

I'm from the VB6 world and haven't used Javascript much yet. I was able to use the Page.RegisterStartupScript function to embed a function to click a submit button that kicked off the database query and response.redirect. I could have still kicked off the timer but that seemed more complex than necessary.

Do you know if a Javascript function can call a code-behind function? If so, what's the syntax?

Thanks again!



Thanks,

Rich





Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Redirect does not work babakwx ASP.NET 2.0 Basics 7 December 2nd, 2008 01:52 AM
response.redirect sarah lee ASP.NET 1.0 and 1.1 Basics 1 October 27th, 2006 08:57 AM
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 10:21 PM
response.redirect crmpicco Classic ASP Basics 3 February 9th, 2005 01:50 AM
Response.Redirect dhborchardt Classic ASP Basics 4 June 16th, 2003 05:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.