views:

426

answers:

2

i'm placing a automatic redirect on my Classic ASP page (vb). i want to call the url from a variable (url2) versus hardcoding it. just need to know what the right syntax is. this is my current code:

Response.AddHeader("REFRESH","10;URL=url2")
A: 

The refresh header is not officially standardised. This means every browser may implement it differently. I'd recommend using normal HTTP casing, like the following:

Response.AddHeader "Refresh", "10; url=" & url2

[Edited to reflect new information from poster]

Otherwise there doesn't seem to be an issue, although if it doesn't still work I'd suspect ASP.NET may strip out the header some place else for its own purposes.

Rushyo
Which browsers implement it differently?
AnthonyWJones
There is no standard implementation, so how they do choose to implement it is completely in the air. It is entirely possible that most modern browsers use exactly the same implementation, but that would be impossible to verify since there's no 'correct' implementation to test against.
Rushyo
(hmm) ok, I can't think of too many different ways to implement wait for x amount of time then navigate to y. To do so that it actually makes a difference to anyone would be quite a feat.
AnthonyWJones
I can think of quite a few ways, having worked on the source code for a couple of browsers. Primarily, what headers do you choose to keep when you do redirect? How do you inform the user you are redirecting? How you do inform Javascript's inherent objects of the change? What DOM events are triggered (inc. bespoke)? I'm sure for 99% of purposes though, the difference would be moot though.
Rushyo
Just to add to that list (because it's an interesting question): What do you do with malformed input? What defines malformed input? Which, if any, of the existing markup/scripts do you evaluate?
Rushyo
+1  A: 

In ASP-Classic/VBScipt:-

Response.AddHeader "Refresh", "10;url=" & strUrl

You don't use ( ) when calling methods from which you do not accept a return value.

AnthonyWJones
i need it to call a variable as the url.
MG
MG
AnthonyWJones