[Gambas-user] Global variable in WebApplication

Benoît Minisini g4mba5 at gmail.com
Wed Jan 16 13:09:43 CET 2019


Le 16/01/2019 à 09:03, Michele V. a écrit :
> I think I understand that it is not possible to manage global variables 
> in WebApplications
> I also tried to create a new class, but it also does not keep the data 
> stored
> the only solution is to rely on external files or a database?
> 
> Thank you
> -------------------------------------------------------------------------------------------------------------------------------------------
> Io scrivo da UBUNTU GNU/LINUX
> 
> 

Use the Session class. Each connection is associated with a session file 
identified by a cookie sent to the browser.

If you use the 'gb.web.form' component, any WebForm acts like a 
Collection you can use to store the equivalent of global variables:

     MyWebForm1["name"] = Value

Of course, behind the scene, everything is stored in the session, so you 
can only use serializable datatypes (those you can use with the WRITE 
instruction).

Regards,

-- 
Benoît Minisini


More information about the User mailing list