You can use the Response.AddHeader method to force a timed reload or delayed refresh / redirection in an ASP page. The following code will cycle the current page every ten seconds (and is functionally equivalent to adding a <META REFRESH> tag to the HTML):
<% Response.AddHeader "Refresh", "10" %> |
And the following code will redirect to http://www.aspfaq.com/ after 35 seconds:
<% Response.AddHeader "Refresh", "35;URL=http://www.aspfaq.com/" %> |
Note that this also prevents referer information from being passed (see
Article #2169 for other examples).
If you are merely trying to prevent your page from caching old results when the user clicks back or otherwise returns to the page, see
Article #2022.
If you are only trying to refresh your page once, this is something better handled on the client side. E.g.:
<script> function refresh() { window.location.reload(); } </script> <button onclick='refresh();'>Refresh the page once</button> |