Dear Aleksandar,

Thank you very much for your answer. However, it does not work. I have tried in many ways with initialisation at very start or just before my function, but nothing work.

At the end I just put the code as you propose it in my cookie functions. The error I keep having is :

[error] [client 127.0.0.1] no context to commit.\n
while executing\n"error "no context to commit.""\n (procedure "fas_context:: commit" line 7)\n invoked from within\n"fas_context::commit"\n (procedure "fas_set_cookie" line 25)\n invoked from within\n"fas_set_cookie fas_session $session_name"\n (procedure "fas_session::export_session" line 8)\n invoke d from within\n"fas_session::export_session"\n (procedure "not_binary::conten t_display" line 41)\n invoked from within\n"not_binary::content_display fasht ml "<center><h1>An error just occured</h1></center><pre>$error<br />$::errorInfo </pre>""\n invoked from within\n"if { ![check_root $file] } {\n\t\tnot_binary ::content_display fashtml "<html><head><title>[translate "Error in "] ${FAS_VIEW
_CGI}</title><body>[translate..."\n    invoked from within\n"web::dispatch"

I checked a little in cookie.ws3, and I see the error generation, but I do not understand why I (always) have it.

Friendly yours,

Arnaud LAPREVOTE
PS : I was pleased to have a message from somebody in Skopje. It gave me the occasion to look where it is.

Aleksandar Nikov a écrit :
Hello Arnaud,


I need a cookie. I know there are very nice sessions. But I really need a cookie. I have a cross-technology web application. It works on cgi (with cgi.tcl), on tclhttpd, on rivet, and I am porting it to websh. As it is such an application, I have my own session environment. And I need to create it again. And I do not catch how cookies are implemented in websh.
You can see the cookie example at http://tcl.apache.org/websh/examples/cookie.html

Basically for setting a cookie in your code would be:

web::cookiecontext fas_context
fas_context::cset $cookie_name $cookie_value
fas_context::commit

Reading a cookie would be:

web::cookiecontext fas_context
set cookie_value [fas_context::cget $cookie_name]
fas_context::commit


Of course, the initialization of the fas_context can be moved to a separate initialization part thus preventing multiple initialization parts.

Also be careful that cookie context need to be committed before any web:puts as it must be sent in the http headers (before sending any part of a page body).

Regards,
Alex


--
Arnaud LAPREVOTE - Directeur R&D                   Mandriva/Linbox FAS
152, rue de Grigy                      Technopôle Metz 2000 57070 METZ
43, rue d'Aboukir                                          75002 PARIS
tel : 03 87 50 87 90 - 06 11 36 15 30             fax : 03 87 75 19 26
E-mail : [EMAIL PROTECTED]        Web: http://mandriva.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to