Official Content

It enables storing data on a Web server user session. Thus, global variables can be accessed while the session is active.

Web servers allow you to handle the concept of a session. A session is identified by a unique key, which is maintained while the user continues on the site.

The WebSession object can store information that will be visible from any Web object within the active session as if they were variables global to the site.

To use the WebSession object, define a variable of this type and apply the appropriate methods and properties:

Properties

Id

Methods

Notes

  • The session ID is stored on a client cookie, although this is transparent for the developer.
  • The WebSession's validity is similar to that of cookies; i.e. they are valid only for the session. If a new browser instance is opened, the session is lost, but if it is opened on a new window, the session is kept.
  • A session's data and ID are different for each generator. This implies that it is not possible to link a .NET Web Panel to a Java Web Panel and keep the session values.

Id

Returns a String which will be the session identifier.

Syntax

&WebSession.Id

Type Returned:
String

Set

Allows entering once in the active session.

Syntax

&WebSession.Set(Key, Value)

Where:
Key
Is the Session key, must be a String

Value
Must be a String

Get

Returns a string corresponding to the key entered for the session.

Syntax

&WebSession.Get(Key)

Type Returned:
String

Where:
Key
Is the Session key, must be a String

Remove

Allows removing a session value.

Syntax

&WebSession.Remove(Key)

Where:
Key
Is the Session key, and must be a String.

Destroy

Destroys the session contents. Its use is recommended when the user logs out, provided this concept exists in it.

Syntax

&WebSession.Destroy()

Scope

Languages Java, .NET, Ruby
Interfaces Web
   



Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant