Table of Contents

Class BPserver

Namespace
PolarStudio
Assembly
PolarStudio.dll

This class is the Server that creates all web applications. Only one server object is running on a server for all users (for one project). The Server is responsible for the presentation layer and uses the data layer as is provided by the BudaEngine.

public class BPserver : PolarWeakEventListener
Inheritance
BPserver
Implements
Inherited Members
Extension Methods

Fields

BrowserCaching_NoStore

This property configures the HTTP headers that are applied for HTTP responses that are to expire immediately. A 'Cache-control: no-store' header can be added, but this behaviour may break the support of the navigate back in the browser.

public bool BrowserCaching_NoStore

Field Value

bool

CookiesBasedSessionManagementOnly

This property set/get the behaviour of allowing sessions for browsers that do not support first party cookies. It is possible to allow session management using a session ID in the URL only, but it is strongly advised to set this property to True. Is set based on a setting in the project.

public bool CookiesBasedSessionManagementOnly

Field Value

bool

ProtectSessionHijacking

This property gets/set the property that configures the protection agains hijacking sessions. ProtectSessionHijacking means that the IP address of a session is stored. When a request comes in for a session from another IP address, this is then treated as a 'hijack' and a new session will be created. If you are in an environment where IP addresses of clients change often, you can choose to disable this feature.

public bool ProtectSessionHijacking

Field Value

bool

ProtectSessionHijacking_UrlBasedSessionIDs

This property is like the property 'ProtectSessionHijacking' but specific for sessions that do not use Cookies but only session IDs in URL's.

public bool ProtectSessionHijacking_UrlBasedSessionIDs

Field Value

bool

Properties

BudaEngine

Returns the reference to the BudaEngine that is tied to the BPserver object.

public BudaEngine BudaEngine { get; }

Property Value

BudaEngine

ConcurrentUsers

This method returns the actual number of concurrent connected users

public int ConcurrentUsers { get; }

Property Value

int

Configuration

The Configuration is set when the server object is constructed. It contains all parameters needed to run the project, like the location of the webroot, the connection to the project database (.bppx) and so on.

public AppConfiguration Configuration { get; }

Property Value

AppConfiguration

Engine

Returns the reference to the BudaEngine that is tied to the BPserver object.

public BudaEngine Engine { get; }

Property Value

BudaEngine

ErrorHistory

This method returns a list of the last 25 unhandled errors that happend in Polar Studio.

public Collection<LoggedError> ErrorHistory { get; }

Property Value

Collection<LoggedError>

GetContext

This method returns the script context for this Server.

public Context GetContext { get; }

Property Value

Context

HostName

This method returns the HostName as provided by IIS. Is only applicable if the IIS application names.

public string HostName { get; }

Property Value

string

InitDateTime

This method returns the UTC date/time the server was started.

public DateTime InitDateTime { get; }

Property Value

DateTime

KeepAliveTimerMinutes

This property gets/sets the KeepAliveTimer in minutes. The KeepAliveTimer is uses to let the browsers send a signal every x minutes. If this signal is not received anymore (and also a grace time has expired) then this browser is expected to be closed. This is used to enable long live-time settings for sessions (for example allow sessions to be 'asleep' for 120 minutes) but free resources as soon as the user closes the browser or shuts down the computer.

public int KeepAliveTimerMinutes { get; }

Property Value

int

LogHttpRequestCount

Set this property to a value to start logging x number of raw HTTP requests. Implement a global script LogHttpRequest(pContext, pWebRequest) to process the requests. The context for this script can be the BPserver (if no session) or the session. For normal calls, the Context.WebSession.Request object is available. In other cases, this object may be Nothing.

public int LogHttpRequestCount { get; set; }

Property Value

int

PhysicalPath

This method returns the physical path of the webroot of Polar Studio

public string PhysicalPath { get; }

Property Value

string

PolarServerApplication

Returns the PolarServerApplication wich is the HTTP-server application that contains this project. Used internally within Polar Studio.

public PolarServerApplication PolarServerApplication { get; }

Property Value

PolarServerApplication

RequiredMainJSscriptVersion

This method returns the version of Main.JS that is required at minimum.

public string RequiredMainJSscriptVersion { get; }

Property Value

string

ServerSupportsCompression

This method returns True if the server does support data compression.

public bool ServerSupportsCompression { get; }

Property Value

bool

Sessions

This method returns all Sessions in the engine, both connected and unconnected.

public Collection<Session> Sessions { get; }

Property Value

Collection<Session>

TimerIntervalSeconds

This Timer is a script (Server_OnTimer) that can be fired every x seconds. Set this value to 0 to stop the timer. This script can be used to run some background tasks. If the application (project) is not loaded this timer will not run. You can for example set this property in the WebSession_OnInitialize event.

public int TimerIntervalSeconds { get; set; }

Property Value

int

TotalBytes

This method returns to total number of bytes the server has sent out (before compression).

public long TotalBytes { get; }

Property Value

long

TotalBytesCompressed

This method returns to total number of bytes the server has sent out (after compression).

public long TotalBytesCompressed { get; }

Property Value

long

TotalErrors

This method returns to total number of unhandled errors that occurred. This does not apply to script-errors.

public int TotalErrors { get; }

Property Value

int

TotalFailedLogins

This method returns to total number of failed logins.

public int TotalFailedLogins { get; }

Property Value

int

TotalHits

This method returns the total number of hits the server has processed.

public long TotalHits { get; }

Property Value

long

TotalLogins

This method returns to total number of successful logins.

public int TotalLogins { get; }

Property Value

int

TotalTicks

This method returns the total number of ticks (milli seconds) the server has been busy processing requests.

public long TotalTicks { get; }

Property Value

long

VirtualDirectory

This method returns the virtual directory in IIS

public string VirtualDirectory { get; }

Property Value

string

Methods

ActiveUsers()

This methor returns a collection of all active (connected) users (Sessions) in this project.

public Collection<string> ActiveUsers()

Returns

Collection<string>

CreateBodyTag(string, string, string, bool, Session, string)

This helper method creates the body tag for a custom HTML page. It is mainly used internally.

public string CreateBodyTag(string pPageType, string pPageDesignSettingsName, string pTitle, bool pAddOnKeyDownEvent, Session pSession, string pScrollPosIDcode = "")

Parameters

pPageType string

The type of page. Use 'ContentWindow', 'PopupWindow' or 'PopupHelp'

pPageDesignSettingsName string

Not used anymore

pTitle string

The title of the page.

pAddOnKeyDownEvent bool

A boolean to indicate if a OnKeyDown event must be added to the body tag.

pSession Session

The WebSession the tag is created for

pScrollPosIDcode string

A unique ID for the page can be used for keeping the ScrollPositions.

Returns

string

A HTML string containing the <head> and <body> tags.

GetFileIcon(string)

This method returns the name of the file-icon (image) for a given file-extension. This way you can for example show an icon for a blob field.

public string GetFileIcon(string pFileExtension)

Parameters

pFileExtension string

The file extension.

Returns

string

an image path like: 'FileIcons/pdf.png'

GetPolarServerIniString(string, string)

This function returns an item from the Windows\PolarServer.ini -file for the given Section / Key. Is superceeded by using the Engine.Configuration that allows setting custom properties.

public string GetPolarServerIniString(string pSection, string pKey)

Parameters

pSection string

The section/chapter to retrieve from

pKey string

The key to retrieve

Returns

string

The value of the key in the given section.

GetReportEngine(BudaApplication)

This method returns a report engine for the given application. For each ApplicationPID, one report engine is kept.

public ReportEngine GetReportEngine(BudaApplication pApplication)

Parameters

pApplication BudaApplication

The application to get the report engine for

Returns

ReportEngine

A report engine.

GetStatsManager(string)

This method returns a StatsManager (an object to keep track of statistics).

public StatsManager GetStatsManager(string pName)

Parameters

pName string

Use 'HiRes' for the 1 minute interval stats manager and 'LoRes' for the 5 minutes interval stats manager.

Returns

StatsManager

GlobalStatistics(clsBPwebRequest)

This method returns a text-formatted string containing the server stats.

public string GlobalStatistics(clsBPwebRequest pRequest = null)

Parameters

pRequest clsBPwebRequest

A clsBPwebRequest can be passed to determine the server IP.

Returns

string

A text formatted string.

SessionByGUID(string)

This method returns the session for the given guid or Nothing if not found.

public Session SessionByGUID(string pGuid)

Parameters

pGuid string

The GUID to search for.

Returns

Session

The found session or Nothing.

Version()

This method returns the version of the executable of Polar Studio, like 1.2.3

public string Version()

Returns

string

A string with the current version of the executable.