View Single Post
  #5 (permalink)  
Old May 3rd, 2011, 05:22 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Hi Phil,

This will never work; all three lines of code execute at the server, and no response is sent back to the client until the page is done loading or you do a Response.Redirect.

I see a few options:

1. Ditch the redirect and replace it with a RegisterStartupScript that sends back *client side JavaScript* to the browser which can then present a popup or an alert box.

2. Pass some status in the query string when redirecting to the new page. Then in the new page, use client side JavaScript to look at the query string and display a pop up.

Hope this helps,

Imar Spaanjaars
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote