tcl redirect

Philip Greenspun's Homepage : Philip Greenspun's Homepage Discussion Forums : 6916 : One Thread
Notify me of new responses
i had asked earlier about ns_returnredirect
and someone had answered saying that i should not return any headers before the command
is there any way to return some headers and then say automatically refresh the page?

-- Sriganesh Lokanathan, September 19, 1999

Answers

If your goal is to set some cookies with one tcl script and then redirect the user to a different tcl script, you can do the following:

    ns_write "HTTP/1.0 302
Set-Cookie: some_variable=[ns_urlencode $some_variable]; Path=/;
Location: some_page.tcl
	
"

Note the blank line at the end of the ns_write. The Set-Cookie line can be repeated as many times as necessary if you want to set multiple cookies.

-- Eve Andersson, September 19, 1999