Back to product page

SessionVars property


Returns collection of session variables.

Type

WebSessionVars object

Syntax

  • C#
  • VB.NET
WebSessionVars SessionVars {get; };

ReadOnly Property SessionVars As WebSessionVars

Remarks

This property holds reference to collection of all session variables set for the user. When at least one session variable is set, wodWebServer.NET will send cookie to the client on each response - waiting to find same same cookie sent back by the client on connections that follow. When such cookie is found, wodWebServer.NET will automatically return previously defined session variables through this property.

Using session variables allows you do easily keep track of user's data during the session (session means more than one request/response). Usual usage is to ask user for login/password once, put it in session variables and then use in each subsequent connection (as long as session doesn't expire). Contents of session variables are never sent to the client - they are only known on the server side, and always kept in memory only.

Adding (and using) session variables is really easy - easy as User.SessionVars.Add("MyVar").Value = 5 or you can do something like this:
 
If User.SessionVars.Exists("MyCount") Then
   User.SessionVars("MyCount") = User.SessionVars("MyCount") + 1
Else
   User.SessionVars.Add("MyCount").Value = 1
End If
 

When no session variables for the user are defined, server does not send any cookies to the client.

Platforms

Windows