server-side timer vs. meta refresh

  • Thread starter Thread starter Jim Hammond
  • Start date Start date
J

Jim Hammond

After much effort, it doesn't seem possible to redirect the user to a new
page after 10 seconds by using a server-side timer. I am now using the
following meta statement to accomplish the same thing:

<META HTTP-EQUIV="refresh" content="10;URL=Form_Welcome.aspx">

This seems to work fine, but I now have three concerns because I thought it
was supposed to be possible to do everything in C#.
1. Note that Visual Studio lets the developer drag and drop a timer onto the
web form, which now seems like a pointless feature.
2. Will server-side code know how to handle the redirection caused by the
META tag as well as if I had used C#?
3. I manually edited the .aspx file, which means that my code is not as
clean and is harder to maintain.

Jim
 
David said:
Or in this case, since it's an HTTP-EQUIV, you can just add the header
directly and forget about the meta tags altogether.

Response.AppendHeader("Refresh", "3; URL=/some/url/here")


Although, in the general case, I don't really see manually editing the
.aspx file as A Bad Thing.

Good call.

I'd agree that editing the aspx file is not necessarily a bad thing - in
fact, it would be my preference if the refresh should be there
unconditionally.

The Response.AddHeader() approach would be the best for dynamically
adding the redirection.
 
Back
Top