server-side timer vs. meta refresh

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
 
M

mikeb

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top