Re: [Cppcms-users] app().session().erase() doesn't work or not permitted?
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2012-04-21 15:38:16
|
>
> string msg;
>
> if (app().session().is_set("msg")) {
> msg = app().session().get("msg"); //works
> app().session().erase("msg"); // doesn't work
> }
>
> return msg; // always returns text because it never gets erased
>
> Is modifying a session via app().session() not permitted or is it a bug?
> Erasing the key from controller works fine.
>
You can't do changes in session **after** writing **any** output
(including just accessing to response().out() without actual I/O)
> Another question - why is session_interface::get() not const?
>
Because it allows to use lazy evaluation, caching etc... You will not find many
const member functions in general withing CppCMS for this reason.
> Cheers,
> Petr
>
Artyom
|