You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-user@tcl.apache.org by Jerry Lam <bo...@hotmail.com> on 2003/11/28 22:58:54 UTC

send two cookies in a page

Hi, 

is it possible to send two cookies from a page?

I tried the following code, it doesn't work.

[code]
     web::cookiecontext cookieSession1 -path "/" -secure false
     cookieSession1::new a
     cookieSession1::cset key1 "value1"
     cookieSession1::commit
     cookieSession1::delete
     web::cookiecontext cookieSession2 -path "/" -secure false
     cookieSession2::new b
     cookieSession2::cset key2 "value2"
     cookieSession2::commit
     cookieSession2::delete
[\code]

Thanks,

Jerry

Re: send two cookies in a page

Posted by Ronnie Brunner <ro...@netcetera.ch>.
> is it possible to send two cookies from a page?

Currently not: in src/generic/cookie.ws3, whenever a cookie is
committed, the corresponding http header is overwritten. 

Although you can have multiple instances of a http header, just changing
[web::response -set ...] with w[eb::response -lappend ...] in the
cookie.ws3 code does not help, because you'll end up with four cookies
in your example. Feel free to fix that in cookie.ws3 and/or
session.ws3 ;-)

Regards
Ronnie

> I tried the following code, it doesn't work.
> 
> [code]
>      web::cookiecontext cookieSession1 -path "/" -secure false
>      cookieSession1::new a
>      cookieSession1::cset key1 "value1"
>      cookieSession1::commit
>      cookieSession1::delete
>      web::cookiecontext cookieSession2 -path "/" -secure false
>      cookieSession2::new b
>      cookieSession2::cset key2 "value2"
>      cookieSession2::commit
>      cookieSession2::delete
> [\code]
----------------------------------------------------------------------
Ronnie Brunner                             ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich   phone +41 1 247 79 79 fax +41 1 247 70 75