Class Session
- Namespace
- PolarStudio
- Assembly
- PolarStudio.dll
This class is created for each (Web)session.
public class Session : PolarWeakEventListener
- Inheritance
-
Session
- Implements
- Inherited Members
- Extension Methods
Fields
BodyCssClass
This property can be used to set a specific class to the body of html pages.
public string BodyCssClass
Field Value
Buttons
The custom buttons is a collection that contains all custom buttons that are defined within polar studio and have the session as context.
public CustomButtons Buttons
Field Value
DefaultResponseHeaders
This property set the default HTTP headers that are added to each web-response. It is a dictionary and headers can be added 'by name', like: Context.WebSession.DefaultResponseHeaders("Cache-Control") = "private"
public Dictionary DefaultResponseHeaders
Field Value
EnableFirstControlToActivate
This property enables/disables the feature to set the focus in the first control. For some mobile applications it can give unexpected behaviours, for example to always show the on-screen keyboard because the application activates the first text box.
public bool EnableFirstControlToActivate
Field Value
FrameLess
This property can be set to indicate the application is not using frames. It changes the way the main.js and browsersettings are loaded (for they are normally loaded in the parent frame).
public bool FrameLess
Field Value
FrameLessContentWindowTemplate
This property contains the HTML template to use for FrameLess sessions.
public string FrameLessContentWindowTemplate
Field Value
FramedContentWindowTemplate
This property contains the HTML template to use for not-FrameLess (thus Framed) sessions.
public string FramedContentWindowTemplate
Field Value
HasOldStyleMenu
This property is to enable the old style menu for as long it is still supported.
public bool HasOldStyleMenu
Field Value
SelectItemPopupHTMLtemplate
Used to set the HTML template for 'Select item popup' controls. (editable and folow allowed)
public string SelectItemPopupHTMLtemplate
Field Value
SelectItemPopupHTMLtemplate_NF
Used to set the HTML template for 'Select item popup' controls. (editable and folow not allowed)
public string SelectItemPopupHTMLtemplate_NF
Field Value
SelectItemPopupHTMLtemplate_RO
Used to set the HTML template for 'Select item popup' controls. (read only and folow allowed)
public string SelectItemPopupHTMLtemplate_RO
Field Value
SelectItemPopupHTMLtemplate_RONF
Used to set the HTML template for 'Select item popup' controls. (read only and folow not allowed)
public string SelectItemPopupHTMLtemplate_RONF
Field Value
SendMessage_AlignButtonsRight
This property can be used to align the OK and Cancel buttons to the right within the dialog.
public bool SendMessage_AlignButtonsRight
Field Value
SendMessage_ReverseButtons
This property can be used to reverse the OK and Cancel buttons in SendMessage dialogs.
public bool SendMessage_ReverseButtons
Field Value
ShowTabSheetCloseButtons
This property enables/disables displaying the close-buttons in the tabsheets
public bool ShowTabSheetCloseButtons
Field Value
SupportDetectFrameSetUnloaded
This property allows detection of unloading the frameset. When a user closes the browser or navigates to another site, the session is instantly (after one minute) closed.
public bool SupportDetectFrameSetUnloaded
Field Value
TextButtonTemplate
This property sets the template as is used for enabled text buttons in the web application.
public string TextButtonTemplate
Field Value
TextButtonTemplate_Disabled
This property sets the template as is used for disabled text buttons in the web application.
public string TextButtonTemplate_Disabled
Field Value
UsePopupsForStateTransitions
This boolean property sets the behaviour to use popups for state transitions. Is outdated when the newer custom control is used for StateTransitions
public bool UsePopupsForStateTransitions
Field Value
Properties
AcceptCompression
Returns a boolean indicating if this session accepts compressed responses.
public bool AcceptCompression { get; set; }
Property Value
ActiveApplication
Returns the current active application.
public Application ActiveApplication { get; }
Property Value
Applications
This method returns the web applications open in this web session.
public IndexedCollection<Application> Applications { get; }
Property Value
AttemptedUsedName
Returns the user name as was used to attempt to log on.
public string AttemptedUsedName { get; }
Property Value
AverageConcurrentUsers
Returns the average number of users. Each hit, the number of users is stored for that hit. So if a session produces 10 hits while there are 5 concurrent users and 10 hits while there are 10 concurrent users, the average concurrent users will be 7.5
public double AverageConcurrentUsers { get; }
Property Value
BPserver
This method returns a reference to the central server object for this project.
public BPserver BPserver { get; }
Property Value
BackHtmlTC
This property gets/set the HTML that is shown when no applications are open.
public string BackHtmlTC { get; }
Property Value
BrowserType
The BrowserType was used to change behaviour for different kind of browsers in the past. Then, Microsoft Internet Explorer had way different features than Netscape. Nowadays, about all browsers are identified as 'NETSCAPE', but mobile browsers (iPad, iPhone and Android) are identified as 'MOBILE'.
public string BrowserType { get; }
Property Value
BrowserVersion
This method takes the version from the browser-identification. Not used anymore.
public double BrowserVersion { get; }
Property Value
BudaEngine
This method returns the Engine (data-layer) for this session.
public BudaEngine BudaEngine { get; }
Property Value
BudaSession
This method returns a reference to the session in the data-layer (BudaSession) that is tied to this session in the presentation layer.
public BudaSession BudaSession { get; }
Property Value
CookiesEnabled
Returns True if cookies are detected in the users browser.
public bool CookiesEnabled { get; }
Property Value
Engine
Returns the Engine that is tied to this session.
public BudaEngine Engine { get; }
Property Value
ExpectedHTMLpageID
Used to protect pages agains CSRF / XSRF attacks. Each request that is processed will change the ExpectedHTMLpageID to prevent abuse for the next request.
public string ExpectedHTMLpageID { get; }
Property Value
ExternalPageShown
This property indicates that the user has navigated (hopefully temporary) to an external page.
public bool ExternalPageShown { get; set; }
Property Value
FirstApplicationID
Returns the SysApplicationID of the first application in this project the user is allowed to use.
public int FirstApplicationID { get; set; }
Property Value
FrameSetQueryString
Returns the QueryString that was used when this session was initiated and the frameset was retrieved.
public clsBPwebQueryString FrameSetQueryString { get; }
Property Value
Framed
This property indicates the current web application runs in a frame / an iframe. It will change the behaviour of redirecting to the correct page.
public bool Framed { get; set; }
Property Value
GUID
Returns a GUID for this object.
public string GUID { get; }
Property Value
HTMLpageID
This HTMLpageID is a number that is increased for each page created in this session. It used to used for additional security but has been superceeded by the ExpectedHTMLpageID, which is a random string.
public long HTMLpageID { get; }
Property Value
HostName
Returns the IIS HostName for this session.
public string HostName { get; }
Property Value
InitialRequestServerVariables
This method returns a string with all server variables ('ALL_RAW') of the initial request used to start this application.
public string InitialRequestServerVariables { get; }
Property Value
IsWebServiceRequest
Returns True if this is a temporary session that is instantiated for processing a webservice request.
public bool IsWebServiceRequest { get; }
Property Value
KeepAliveTimerMinutesResponseTime
This property can be used to alter (only to increase) the response time for a abandonned session using the KeepAliveTimer mechanism.
public int KeepAliveTimerMinutesResponseTime { get; set; }
Property Value
LanguageChosenByUser
This property gets/set the language as is chosen by the user. This is used if the user changes the language before loggin in; after logging in, the system knows the user has just changed the language and can store that language, else, the system can restore the last known chosen language for this user.
public object LanguageChosenByUser { get; set; }
Property Value
LanguageID
This property gets/sets the language for the current session.
public int LanguageID { get; set; }
Property Value
LastHitSeconds
This method returns the number of seconds ago a request was processed the last time for this session.
public long LastHitSeconds { get; }
Property Value
LocalSession
Returns True if the session is called from the local computer (127.0.0.1 or ::1)
public bool LocalSession { get; }
Property Value
LockSessionTimeOutMinutes
This property gets/set time timeout (in minutes) before the lock screen is automatically shown. Use 0 for 'never'.
public int LockSessionTimeOutMinutes { get; set; }
Property Value
LogonAttemptCounter
This property counts the number of (failed) logon attempts. It is reset when the user logs off (after a successful log on)
public int LogonAttemptCounter { get; }
Property Value
LogonDateTime
Returns the UTC date/time the user logged on.
public DateTime LogonDateTime { get; }
Property Value
MainJSscriptVersion
Returns the version of the Main.JS script.
public string MainJSscriptVersion { get; }
Property Value
MaxLogonAttempts
This property gets/sets the maximum number of logon attempts before the session is locked out.
public int MaxLogonAttempts { get; set; }
Property Value
Messages
Returns the messages that are queued to be sent out to the user's browser.
public BrowserMessages Messages { get; }
Property Value
MessagesProfile
This property gets/sets the messages profile. A messages profile can be used to create a sub-set of messages. For example for a mobile browser, this profile can be set to 'mobile'. For all messages that are then retrieved, first a version is looked up in which the name ends on '.mobile'. If that message is not found, the name without '.mobile' is used.
public string MessagesProfile { get; set; }
Property Value
PageNumber
Used internally to detect moveback actions.
public int PageNumber { get; }
Property Value
ProcessRequestLockTimeoutSeconds
Although the server is multi-threading, for a single session all requests are handled sequentially. This timeout (in seconds) sets the maximum number of seconds to wait for processing a request when another request is already processed.
public int ProcessRequestLockTimeoutSeconds { get; set; }
Property Value
ReconnectURLqueryString
Used internally for reconnecting after a session is expired. This feature preserves url-parameters that were used for the initial request after the reconnect. For example required if a uses goes to application with 'CustomerID=88' in the url. After disconnect and reconnect, the user still wants to see the application for customer 88, not for custer 1.
public string ReconnectURLqueryString { get; set; }
Property Value
RemoteIP
Returns the IP address of the session (based on the first request). This can be in ip-4 format or ip-6 format.
public string RemoteIP { get; }
Property Value
Request
This method returns the current Request object that is used to process a request from the browser. Can be Nothing if a script runs while no request is being processed.
public Request Request { get; }
Property Value
ScreenHeight
Returns the known height of the user's browser in css pixels (may be different from the actual pixels).
public int ScreenHeight { get; set; }
Property Value
ScreenReservedBorderHeight
Used to reserve a border for some custom sized controls (like the zoomed memo box). Is hardly used anymore and superceeded by using CSS.
public int ScreenReservedBorderHeight { get; set; }
Property Value
ScreenReservedBorderWidth
Used to reserve a border for some custom sized controls (like the zoomed memo box). Is hardly used anymore and superceeded by using CSS.
public int ScreenReservedBorderWidth { get; set; }
Property Value
ScreenWidth
Returns the known width of the user's browser in css pixels (may be different from the actual pixels).
public int ScreenWidth { get; set; }
Property Value
SessionDuration
This method returns the total session duration.
public DateTime SessionDuration { get; }
Property Value
SessionIDcode
Returns the SessionIDcode for this web-session. The SessionIDcode is added to the URL of all requests in this session for additional safety and is part of the session management.
public string SessionIDcode { get; }
Property Value
ShowChangePasswordDialog
Used to show the change password dialog. Use... 0: Do not show: '+1: Show the dialog'; '+2': LogOffIfNotSuccessful ; '+4: required old password'
public enumShowChangePasswordDialog ShowChangePasswordDialog { get; set; }
Property Value
ShowChangePasswordDialog_PasswordExpiryTime
The expiration-date/time of the current entered password. Is used to prevent the dialog to be on screen for a long time, in which someone else can enter a new password when the computer is left alone. Use the local time for this property.
public DateTime ShowChangePasswordDialog_PasswordExpiryTime { get; set; }
Property Value
ShowChangePasswordDialog_PasswordExpiryTimeX
As property ShowChangePasswordDialog_PasswordExpiryTime, but instead of the local time, this property uses the SystemTime (UTC)
public DateTime ShowChangePasswordDialog_PasswordExpiryTimeX { get; set; }
Property Value
TextButtons
Returns the TextButtons for this application. The TextButtons object can be used to create or change custom text buttons.
public TextButtons TextButtons { get; }
Property Value
TimeOut
This property gets/sets the Timeout in minutes. If the user is not active for the specified number of minutes, the user is logged off. The value must be between 5 and 1440 minutes.
public int TimeOut { get; set; }
Property Value
TotalBytes
Returns the total number of bytes for all processed requests in this session.
public double TotalBytes { get; }
Property Value
TotalHits
This method returns the total number of hits that are processed in this session.
public int TotalHits { get; }
Property Value
TotalTicks
This method returns the total ticks used to process requests for this session.
public long TotalTicks { get; }
Property Value
UIbuttons
Returns all session-buttons that are created in Polar Studio. The buttons are indexed on their name.
public Buttons UIbuttons { get; }
Property Value
UserAgent
Returns the string sent by the browser to identify the UserAgent
public string UserAgent { get; }
Property Value
Variables
The Variables can be used to store custom information in the (Web)Session
public Dictionary Variables { get; }
Property Value
Methods
CreateDeleteButton(string)
This helper function is meant to create the HTML to show the standard delete button for a given RecordID. This helper is meant for custom controls.
public string CreateDeleteButton(string pRecordID)
Parameters
pRecordID
stringThe RecordID
Returns
- string
The html for the delete button.
CreateSelectItemPopupHTML(string, object, string, string, string, string)
This method can be used by scripts to create the HTML to show a select-item popup control.
public string CreateSelectItemPopupHTML(string pFieldName, object pRepostFormOnChange, string pValue, string pDisplayValue, string pStyleAndClassExpression, string pFollowLinkHTML = "")
Parameters
pFieldName
stringThe HTML name of the field
pRepostFormOnChange
objectSet this parameter to True if a repost must be applied when the user selects another value.
pValue
stringThe initial value of this control
pDisplayValue
stringThe initial display value of the control.
pStyleAndClassExpression
stringA full string with: class='...' style='...'
pFollowLinkHTML
stringThe html for the follow-link button.
Returns
- string
The html for the SelectItemPopup control.
HistoryClear()
This method clears the history of actions. This history is used to determine the behaviour if the user presses the back button in the browser.
public void HistoryClear()
HistoryGoBack()
This method is to invoke a 'go back in history' action and brings the user back one step in the application (if possible).
public void HistoryGoBack()
LogOff()
This method is used to log off from the web session. It is possible to directly let this be followed by a Logon, to logon as a different user for example.
public void LogOff()
LogOn(string, string)
This method tries to log on in this session with the given credentials. Give an empty string for both the UserID and the password to let the 'Automatic logon' run.
public bool LogOn(string pUserID, string pPassword)
Parameters
Returns
OpenApplication(string)
This method will open a web-application for the current session. If the application is already open, it will be moved to the foreground.
public void OpenApplication(string pApplicationPID)
Parameters
pApplicationPID
stringThe PID, Name or SysApplicationID of the application to open.
RequestOneTimePassword()
This method is meant to start the request for a new One Time Password. A number of events must be implemented to let this work. Please use the documentation for more info.
public string RequestOneTimePassword()
Returns
ScriptActionURL(Context, string, string, bool, string, bool)
This property allows a script action to be registered in the session and to be initiated by an URL. This way, there is less need for adding 'Unprotected'-scripts.
public string ScriptActionURL(Context pContext, string pOnActionScript, string pUpdateMode = "Update", bool pReturnAsPlainJavascriptExpression = false, string pConfirmationQuestion = "", bool pInteractive = false)
Parameters
pContext
ContextThe Context the script must run in.
pOnActionScript
stringThe action to perform, like 'CallMyAction(Context, 55)'
pUpdateMode
stringMust the action be carried out with out without update. Use one of 'update' (changes sent to server and updated. If update fails, the action is not performed), 'noupdate' (al changes are discarded), 'quickupdate' (changes sent to the server but not yet saved)
pReturnAsPlainJavascriptExpression
boolIf this parameter is passed as True, a plain javascript expression is returned. Else, an expression is returned as can be used for an anchor (A) html element, like 'javascript;GetParent().DoAction..'
pConfirmationQuestion
stringAn optional question to ask the user for confirmation before
pInteractive
boolA boolean indicating the action must be carried out 'interactive' (instead of posting the whole form).
Returns
- string
An URL containing a javascript expression or only the play javascript expression.
SendMessage(string, bool, string, string, string, string, string, string, string, object, string, Context)
This method sends a message to a user that is shown in a popup in the browser.
public void SendMessage(string pMessage, bool pMessageIsHtmlFormatted = false, string pCaption = "", string pIconURL = "", string pOnOkScript = "", string pOnCancelScript = "", string pOkButtonCaption = "", string pCancelButtonCaption = "", string pStyle = "", object pReverseButtons = null, string pOnCloseScript = "", Context pContext = null)
Parameters
pMessage
stringThe message to send to the user.
pMessageIsHtmlFormatted
boolA boolean parameter indicating the passed message contains HTML. Only pass as true if your own code makes sure al variable data is converted to HTML.
pCaption
stringAn optional caption for the caption of the popup dialog
pIconURL
stringThe URL to use for the icon that is shown in the popup.
pOnOkScript
stringThe script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.
pOnCancelScript
stringThe Cancel button will be hidden if this parameter is empty. Use only a minus character to show the cancel button but to take no action. Else, this paramater contains the script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.
pOkButtonCaption
stringThe caption of the OK button if it should be differen than OK. Specify as '---' (3x minus) to completely hide the OK button.
pCancelButtonCaption
stringThe caption of the Cancel button if it should be differen than Cancel.
pStyle
stringA css-class that is applied to the elements in the Popup and that can be used to style popups using your custom CSS.
pReverseButtons
objectA boolean parameter to indicate that the OK and Cancel buttons must trade places (thus Cancel / OK)
pOnCloseScript
stringThe Close-cross button in the top-right corner of the dialog will be hidden if this parameter is empty. Use only a minus character to show the close button but to take no action. Else, this paramater contains the script-expression to execute server side when the users clicks the OK button. The expression can be preceeded by an exclamation-mark to run the given script-expression 'interactively'. When an expression is given that starts with a @, this expression is fired as javascript in the browser.
pContext
ContextThe context to use for the action-scripts. In particular in a multiple document environment this can be important.
SendSSEmessage(string, string, int)
This method is used to send a SSE (server side event) message to the browser. In the browser, the receiver must have registered itself first. The message is queued, so all messages are sent sequentially to the browser.
public void SendSSEmessage(string pReceiver, string pPayload, int pValidLifeTimeSeconds = 60)
Parameters
pReceiver
stringThe name of the receiver as was used in the browser.
pPayload
stringThe payload to send to the receiver. Preferably a JSON string.
pValidLifeTimeSeconds
intThe time in seconds this message is valid. Defaults to 60. If the message expires before it could be delivered, it will be removed.
SetLanguageBasedOnBrowser()
This method will set the language of the session based on the Accept-language http header sent by the browser.
public void SetLanguageBasedOnBrowser()
ShowLockScreen()
This method shows the LockScreen. The user must than re-enter the (one time) password to reactivate the session.
public void ShowLockScreen()