# Application

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

Represent a Wisej application session. Provides methods and events to manage the application in the context of the current session.

{% tabs %}
{% tab title="C#" %}

```csharp
public class Application : IWisejComponent, IDisposable, IWisejSynchronized
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class Application
    Inherits IWisejComponent
    Implements IDisposable, IWisejSynchronized
```

{% endtab %}
{% endtabs %}

This class provides several static methods, properties and events that allow the application to manage all sorts of features related to the current session:

* Save and retrieve session variable. Use [Session](#session) to store and retrieve session variable. The property is a dynamic object and a [Dictionary](https://docs.microsoft.com/dotnet/api/system.collections.generic.dictionary-2), therefore you can access its properties directly or through the indexer.

```csharp

    Application.Session.myValue = 12;
    Application.Session["myValue"] = 12;
  
```

* Manage cookies. Use [Cookies](#cookies) to manage browser's cookies.
* Read server variables. Use [ServerVariables](#servervariables) to retrieve all the data made available by the server. Some of the variables in the collection are also available directly: [ServerPort](#serverport), [ServerName](#servername), [UserAgent](#useragent), etc.
* Read the application's URL. Use [Uri](#uri), [Url](#url), [StartupUri](#startupuri), and [StartupUrl](#startupurl).
* Read the application's system information. Use [StartupPath](#startuppath), [ProductName](#productname), [ProductVersion](#productversion), etc.
* Listen to the application's global events. See [SessionTimeout](#sessiontimeout) , [BeginRequest](#beginrequest), [ApplicationStart](#applicationstart), [ApplicationExit](#applicationexit)[ApplicationRefresh](#applicationrefresh), [BrowserSizeChanged](#browsersizechanged)[ResponsiveProfileChanged](#responsiveprofilechanged), [CultureChanged](#culturechanged), and many more.
* Retrieve browser related information. Use the [Browser](#browser) to read the client browser type, OS, version, capabilities, screen size, browser size, language, and state. The [Browser](#browser) object is updated automatically when the user resizes the browser or the page is reloaded.
* Control the client browser. Start a [Download](#download-filepath-filename-ondownload), execute JavaScript functions or scriptlets using [Call](#call-function-args) or [Eval](#eval-script). Make the browser navigate to a different URL using [Navigate](#navigate-url-target) or simply [Reload](#reload) the page.
* Manage the main page or current desktop. [MainPage](#mainpage) lets you change the [Page](https://docs.wisej.com/api/wisej.web/containers/wisej.web.page) object that fills the browser and "navigate" from page to page. [Desktop](#desktop) lets you change the active [Desktop](https://docs.wisej.com/api/wisej.web/containers/desktop) object on the client browser.
* Manage all live components in the session. Through the [Application](https://docs.wisej.com/api/wisej.web/general/application) class you can find, iterate, inspect all live components of any type. See [OpenForms](#openforms) for all the currently created (visible or invisible) instances of [Form](https://docs.wisej.com/api/wisej.web/containers/form). [OpenPages](#openpages) returns all the created [Page](https://docs.wisej.com/api/wisej.web/containers/wisej.web.page) objects. [FindComponent](#findcomponent-match) and [FindComponents](#findcomponents-match) provide an easy way to find any component in the session or to iterate the list of components that match a custom expression.
* Start background tasks in context. [StartTask](#starttask-action) provides a powerful way to start a background task on the server that can keep interacting with the client browser while running independently.
* Manage the application's theme. Use [LoadTheme](#loadtheme-name-mixins) to load a Wisej theme into the application. Or use the [Theme](#theme) object to read all sorts of information from the current [ClientTheme](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clienttheme).
* Terminate the application without waiting for the session to timeout. Use [Exit](#exit) to terminate the current session and free all the related memory.

There is a lot more exposed by the [Application](https://docs.wisej.com/api/wisej.web/general/application) class. You can inspect all the properties and methods in Visual Studio through IntelliSense or online at [docs.wisej](https://docs.wisej.com).

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ActiveProfile

[ClientProfile](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clientprofile): Returns or sets the current client responsive profile.

This is the profile that best matches the current browser on the client. It is updated automatically on every request.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Browser

[ClientBrowser](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clientbrowser): Returns or the client browser's information.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ClientCertificate

[X509Certificate2](https://docs.microsoft.com/dotnet/api/system.security.cryptography.x509certificates.x509certificate2): EXPERIMENTAL: Provides the client certificate fields issued by the client in response to the server's request for the client's identity. <mark style="color:blue;background-color:green;">Since 3.5.6</mark>

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ClientId

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the current unique client id.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Clients

[ClientCollection](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clientcollection): Returns a collection of all the unique client browsers using the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CommandManager

[CommandManager](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.commandmanager): Returns the current [CommandManager](#commandmanager).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CommonAppDataPath

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the path for the application data that is shared among all users.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CommonAppDataRegistry

[RegistryKey](https://docs.microsoft.com/dotnet/api/microsoft.win32.registrykey): Returns the registry key for the application data that is shared among all users.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CompanyName

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the company name associated with the application stored in the [AssemblyCompanyAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblycompanyattribute).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Configuration

[Configuration](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.configuration): Returns the current [Configuration](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.configuration).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Cookies

[CookieCollection](https://docs.wisej.com/api/wisej.base/general/wisej.base.cookiecollection): Collection of cookies.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Current

[IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent): Returns the application component instance that an application can store and use later to restore the context when updating client widgets during an out-of-bound call using the [Update](#update-context-action) method.

Threads that are not started using [StartTask](#starttask-action) don't have any knowledge of the current session and don't have a way to communicate with the client The [Current](#current) property returns the instance of the [Application](https://docs.wisej.com/api/wisej.web/general/application) class that is bound to the current session. It can be used just like any other component with the method [Update](#update-context-action) or [RunInContext](#runincontext-context-action) to restore the session for the current thread. The advantage of using [Current](#current) instead of the instance of a control or a page is to avoid to keep a reference to a component that may be disposed by the application.

```csharp

var current = Application.Current;
var thread = new Thread(() => {
  Application.Update(current, () => {
  
    // code here is running in context.
    
  });
});

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CurrentCulture

[CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo): Returns or sets the current [CultureInfo](https://docs.microsoft.com/dotnet/api/system.globalization.cultureinfo) for the session.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Desktop

[Desktop](https://docs.wisej.com/api/wisej.web/containers/desktop): Returns or sets the current Desktop.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) EnableUnloadConfirmation

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the browser will ask the user to confirm unloading the current page.

This property attaches the window\.onbeforeunload event. See <https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload>. It's not possible to determine whether the page is being unloaded because the user is trying to close the tab, close the browser, or is refreshing the page, or is taking any other action that may reload the page.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ExecutablePath

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the path for the application's main assembly.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) FavIcon

[Image](https://docs.microsoft.com/dotnet/api/system.drawing.image): Returns or sets the favicon to display in the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) FavIconSource

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the URL to the favicon to display in the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Hash

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the hash part of the URL on the client.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) IsAuthenticated

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns a value indicating whether the session has been authenticated.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) IsDisposed

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Indicates that the current application instance, which corresponds to the session, has been terminated and disposed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) IsExpired

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns true when the current session has expired.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) IsSecure

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns true if this session is running in secure mode (https\:// and wss\://)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) IsTerminated

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns true when the current session has been terminated.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) IsWebSocket

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns true if the current session is connected using WebSocket.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LicenseInfo

[Object](https://docs.microsoft.com/dotnet/api/system.object): Returns a dynamic object containing the currently loaded license information. <mark style="color:blue;background-color:green;">Since 3.1.3</mark>

These are the currently available fields (may change in future releases):

* Valid: Whether the license is valid. Note that a license may be expired and valid if the product release date is within the license expiration date.
* LicenseKey: License key loaded from web.config or assigned to [LicenseKey](#licensekey).
* ProductName: Full name of the licensed product.
* CustomerName: Name of the registered customer that owns the license.
* ExpirationDate: Expiration date for the product free updates.

Retrieve the values either using a dynamic object or a property indexer:

```csharp

  string productName = Application.LicenseInfo.ProductName;
  string customerName = Application.LicenseInfo["CustomerName"];

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LicenseKey

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the runtime server license key.

Setting the [LicenseKey](#licensekey) programmatically has to be done before the application is loaded. The best place is the static constructor for the Program static class, or the static constructor of the main window (if defined in Default.js).

```csharp

static class Program
{
  static Program()
  {
    Application.LicenseKey = "...";
  }
}

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) MainPage

[Page](https://docs.wisej.com/api/wisej.web/containers/wisej.web.page): Returns or sets the current full page window.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) OpenForms

[FormCollection](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.application.formcollection): Returns a collection of open forms owned by the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) OpenPages

[PageCollection](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.application.pagecollection): Returns a collection of open pages owned by the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Platform

[ClientPlatform](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clientplatform): The name of the currently loaded platform.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ProductName

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the product name associated with this application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ProductVersion

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the product version associated with this application stored either in [AssemblyInformationalVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyinformationalversionattribute) or [AssemblyFileVersionAttribute](https://docs.microsoft.com/dotnet/api/system.reflection.assemblyfileversionattribute).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) QueryString

[NameValueCollection](https://docs.microsoft.com/dotnet/api/system.collections.specialized.namevaluecollection): Returns the parameters used to launch the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Referrer

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the original URL from the first "HTTP\_REFERER" header. Corresponds to the new custom server variable "ORIGINAL\_REFERRER".

This value is an empty string in most cases, since it contains the URL of the first non Wisej.NET page loaded in the browser, from which a user has clicked an hyperlink to navigate to the Wisej.NET application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RightToLeft

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether all the controls in the applications should operate using the right-to-left mode.

The value of this property is updated automatically when the current language changes if the value of "rightToLeft" in the application configuration file is set to "auto".

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RuntimeMode

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns true when the application is running in not in design, debug or test mode.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ServerName

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the server's host name, DNS alias, or IP address as it would appear in self-referencing URLs.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ServerPort

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the port number to which the request was sent.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ServerVariables

[NameValueCollection](https://docs.microsoft.com/dotnet/api/system.collections.specialized.namevaluecollection): Returns the server variables.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Services

[ServiceProvider](https://docs.wisej.com/api/wisej.services/general/wisej.services.serviceprovider): Returns the [ServiceProvider](https://docs.wisej.com/api/wisej.services/general/wisej.services.serviceprovider) implementation used by Wisej.NET to manage Dependency Injection across the application. <mark style="color:blue;background-color:green;">Since 3.1</mark>

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Session

[Object](https://docs.microsoft.com/dotnet/api/system.object): Provides a generic storage for session-based objects.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) SessionCount

[Int32](https://docs.microsoft.com/dotnet/api/system.int32): Returns the total number of currently active sessions.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) SessionId

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the unique current session ID.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ShowConsole

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Shows or hides the debug console on the browser.

Displays a simple HTMl only debug console. Works with any browser also when the developer tools are not available.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ShowLoader

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets whether the browser is blocked by the Ajax loader.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartupPath

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the root path of the web application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartupUri

[Uri](https://docs.microsoft.com/dotnet/api/system.uri): Returns the URI used to start the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartupUrl

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the URL used to start the application.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Theme

[ClientTheme](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clienttheme): Returns or sets the current [ClientTheme](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clienttheme).

You can create and modify a new custom theme using the [ClientTheme](https://docs.wisej.com/api/wisej.web/general/application/wisej.core.clienttheme) class. The new theme can be based on an existing theme, can be empty, or can be initialized from a JSON string.

```csharp

// create a new custom theme cloned from the current theme.
var myTheme = new ClientTheme("MyTheme", Application.Theme);

// alter the buttonFace color.
myTheme.Colors.buttonFace = "red";

// update the current session using the new custom theme.
Application.Theme = myTheme;

```

You may also alter a global theme shared by all sessions.

```csharp


// change the buttonFace color in the current theme.
// if the theme is one of the global themes, i.e. it was loaded
// using Application.LoadTheme(name), then the change is also global.
Application.Theme.Colors.buttonFace = "red";

// since the theme objects are all dynamic and use a special DynamicObject
// class part of the Wisej Framework, you can also use a string indexer
// to address any field.
Application.Theme.Colors["buttonFace"] = "red";


```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Title

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns or sets the page title in the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Uri

[Uri](https://docs.microsoft.com/dotnet/api/system.uri): Returns the current [Uri](https://docs.microsoft.com/dotnet/api/system.uri) used either to launch or reload the application. It may be different from [StartupUri](#startupuri).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Url

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the current URL used either to launch or reload the application. It may be different from [StartupUrl](#startupurl).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) User

[IPrincipal](https://docs.microsoft.com/dotnet/api/system.security.principal.iprincipal): Returns the security information for the current request.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) UserAgent

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the raw user agent string of the client browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) UserHostAddress

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the IP host address of the remote client.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) UserHostName

[String](https://docs.microsoft.com/dotnet/api/system.string): Returns the DNS name of the remote client.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) UserIdentity

[WindowsIdentity](https://docs.microsoft.com/dotnet/api/system.security.principal.windowsidentity): Returns the [WindowsIdentity](https://docs.microsoft.com/dotnet/api/system.security.principal.windowsidentity) type for the current user.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) UserLanguages

[String\[\]](https://docs.microsoft.com/dotnet/api/system.string): Gets a sorted string array of client language preferences.

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) AddEventFilter(filter)

Adds an event filter to monitor all the incoming events before they are routed to their respective component.

| Parameter  | Type                                                                                  | Description                                                                                                                                              |
| ---------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **filter** | [IEventFilter](https://docs.wisej.com/api/wisej.core/general/wisej.core.ieventfilter) | An object that implements the [IEventFilter](https://docs.wisej.com/api/wisej.core/general/wisej.core.ieventfilter) interface to add to the filter list. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) AddTranslation(text, translation)

Adds the text and corresponding translation to the default locale on the client.

| Parameter       | Type                                                          | Description               |
| --------------- | ------------------------------------------------------------- | ------------------------- |
| **text**        | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text to translate.    |
| **translation** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The translation override. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) AlertAsync(message)

Instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.

| Parameter   | Type                                                          | Description                                       |
| ----------- | ------------------------------------------------------------- | ------------------------------------------------- |
| **message** | [String](https://docs.microsoft.com/dotnet/api/system.string) | A string you want to display in the alert dialog. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Call(function, args)

Executes the JavaScript function on the client.

| Parameter    | Type                                                              | Description                            |
| ------------ | ----------------------------------------------------------------- | -------------------------------------- |
| **function** | [String](https://docs.microsoft.com/dotnet/api/system.string)     | The name of the function to execute.   |
| **args**     | [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object) | The arguments to pass to the function. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Call(function, callback, args)

Executes the JavaScript function on the client and receives the return value (or null) in the *callback* method.

| Parameter    | Type                                                                     | Description                                                  |
| ------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------ |
| **function** | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The name of the function to execute.                         |
| **callback** | [Action\<Object>](https://docs.microsoft.com/dotnet/api/system.action-1) | Asynchronous callback method that receives the return value. |
| **args**     | [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object)        | The arguments to pass to the function.                       |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CallAsync(function, args)

Asynchronously executes the JavaScript function on the client and returns an awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) with the result of the remote call.

| Parameter    | Type                                                              | Description                            |
| ------------ | ----------------------------------------------------------------- | -------------------------------------- |
| **function** | [String](https://docs.microsoft.com/dotnet/api/system.string)     | The name of the function to execute.   |
| **args**     | [Object\[\]](https://docs.microsoft.com/dotnet/api/system.object) | The arguments to pass to the function. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CancelFullScreen()

Cancels the fullscreen mode.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ConfirmAsync(message)

Instructs the browser to display a dialog with an optional message, and to wait until the user either confirms or cancels the dialog. until the user dismisses the dialog.

| Parameter   | Type                                                          | Description                                         |
| ----------- | ------------------------------------------------------------- | --------------------------------------------------- |
| **message** | [String](https://docs.microsoft.com/dotnet/api/system.string) | A string you want to display in the confirm dialog. |

**Returns:** [Task\<Boolean>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Dispose()

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Download(filePath, fileName, ondownload)

Downloads the specified file on the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------- |
| **filePath**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The file to download.                                    |
| **fileName** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media)   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The name of the file to save on the client.              |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Download(image, fileName, ondownload)

Downloads the specified image to the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------- |
| **image**                                                                                                                                                                                                                    | [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image)      | The image to download.                                   |
| **fileName**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The name of the file to save on the client.              |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Download(stream, fileName, ondownload)

Downloads the bytes in the stream to the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                              |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------- |
| **stream**                                                                                                                                                                                                                   | [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream)         | The stream to send to the client.                        |
| **fileName**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The file name the client will use to save the stream.    |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) DownloadAndOpen(target, filePath, fileName, ondownload)

Downloads the specified file on the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| **target**                                                                                                                                                                                                                   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | Specifies where to open the file. Leave empty or use "\_self" to open in the current tab, \_blank to open in a new tab. |
| **filePath**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The file to download.                                                                                                   |
| **fileName** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media)   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The name of the file to save on the client.                                                                             |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded.                                                                |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) DownloadAndOpen(target, image, fileName, ondownload)

Downloads the specified image to the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| **target**                                                                                                                                                                                                                   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | Specifies where to open the file. Leave empty or use "\_self" to open in the current tab, \_blank to open in a new tab. |
| **image**                                                                                                                                                                                                                    | [Image](https://docs.microsoft.com/dotnet/api/system.drawing.image)      | The image to download.                                                                                                  |
| **fileName**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The name of the file to save on the client.                                                                             |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded.                                                                |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) DownloadAndOpen(target, stream, fileName, ondownload)

Downloads the bytes in the stream to the client.

| Parameter                                                                                                                                                                                                                    | Type                                                                     | Description                                                                                                             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------- |
| **target**                                                                                                                                                                                                                   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | Specifies where to open the file. Leave empty or use "\_self" to open in the current tab, \_blank to open in a new tab. |
| **stream**                                                                                                                                                                                                                   | [Stream](https://docs.microsoft.com/dotnet/api/system.io.stream)         | The stream to send to the client.                                                                                       |
| **fileName**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The file name the client will use to save the stream.                                                                   |
| **ondownload** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<String>](https://docs.microsoft.com/dotnet/api/system.action-1) | Optional callback invoked when *fileName* is downloaded.                                                                |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) EndPolling()

Stops the polling requests from the client.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Eval(script)

Executes the JavaScript script on the client.

| Parameter  | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| **script** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The script to evaluate. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Eval(script, callback)

Executes the JavaScript script on the client and receives the return value (or null) in the *callback* method.

| Parameter    | Type                                                                     | Description                                                  |
| ------------ | ------------------------------------------------------------------------ | ------------------------------------------------------------ |
| **script**   | [String](https://docs.microsoft.com/dotnet/api/system.string)            | The script to evaluate.                                      |
| **callback** | [Action\<Object>](https://docs.microsoft.com/dotnet/api/system.action-1) | Asynchronous callback method that receives the return value. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) EvalAsync(script)

Asynchronously executes the JavaScript script on the client and returns an awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) with the result of the remote call.

| Parameter  | Type                                                          | Description             |
| ---------- | ------------------------------------------------------------- | ----------------------- |
| **script** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The script to evaluate. |

**Returns:** [Task\<Object>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Exit()

Terminates the application and the corresponding session.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) FindComponent(match)

Find the first component that matches the conditions defined in the predicate function.

| Parameter | Type                                                                                    | Description                                                                                                                                                                                                         |
| --------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **match** | [Predicate\<IWisejComponent>](https://docs.microsoft.com/dotnet/api/system.predicate-1) | A custom [Predicate](https://docs.microsoft.com/dotnet/api/system.predicate-1) expression used to match the [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) to find. |

**Returns:** [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent). The first [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) qualified by the *match* expression.

This method lets an application find any live component in the current session.

```csharp

  // Find the first component that is a Button with Text = "OK"
  var button = Application.FindComponent(c => c is Button && ((Button)c).Text == "OK");

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) FindComponents(match)

Finds all the components that match the conditions in the predicate function.

| Parameter | Type                                                                                    | Description                                                                                                                                                                                                                         |
| --------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **match** | [Predicate\<IWisejComponent>](https://docs.microsoft.com/dotnet/api/system.predicate-1) | A custom [Predicate](https://docs.microsoft.com/dotnet/api/system.predicate-1) expression used to match the list of [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) objects to find. |

**Returns:** [IList\<IWisejComponent>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ilist-1). The list of [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) instances qualified by the *match* expression.

This method lets an application iterate through all the live components in the current session.

```csharp

  // List all text boxes that are read only in all forms.
  var list = Application.FindComponents(c => c is TextBox && ((TextBox)c).ReadOnly);

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) GetInstance\<T>(reference, builder)

Returns a session-static instance of *T* . <mark style="color:blue;background-color:green;">Since 3.2.7</mark>

| Parameter                                                                                                                                                                                                                 | Type                                                                                                                     | Description                                              |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| **T**                                                                                                                                                                                                                     |                                                                                                                          | Type of the singleton object.                            |
| **reference** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-912a3bc068ac1c69bcaa58145e4ee468ccd8a555%2Fbadge-byref.svg?alt=media)  | [SessionReference\<T>](https://docs.wisej.com/api/wisej.web/general/wisej.web.sessionreference-less-than-t-greater-than) | Thread-static reference to the *T* singleton.            |
| **builder** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Func\<T>](https://docs.microsoft.com/dotnet/api/system.func-1)                                                          | Optional method for the creation of an instance of *T* . |

**Returns:** [T](https://docs.wisej.com/api/wisej.web/general/application). The singleton instance of *T* associated with the current session.

This utility method simplifies the management of session-static (or session singleton) instances. It should be used to convert traditional static variables to session-static instances when changing an application designed for single users to a multi-user system. The code below shows how to use this feature together with the [ThreadStaticAttribute](https://docs.microsoft.com/dotnet/api/system.threadstaticattribute) to manage session-static instances and, at the same time, improve the speed of the code that relies on the singleton objects. Using the [ThreadStaticAttribute](https://docs.microsoft.com/dotnet/api/system.threadstaticattribute) backing field allows the code that retrieves the session-static instance to quickly check the last instance and compare the session id and avoid accessing the dictionary for every access within the same request. Otherwise the code would have to always store a local variable in order to speed up multiple operations using the same static field.

```csharp


public class MyStatics {

  // Thread-static singleton.
  [ThreadStatic] private static SessionReference<MyStatics> _instance;
  
  // Previously static fields (or properties).
  public int Counter;

  // Session singleton.
  public MyStatics Instance
    => Application.GetInstance(ref _instance);
    
  public static void DoSomething()
  {
    // was MyStatics.Counter++;
    MyStatics.Instance.Counter++;
  }
}


```

If the class a private constructor (to simulate a static class) or required initialization code or arguments, use the optional builder method:

```csharp


public class MyStatics {

  private MyStatics() { };
  
  // Thread-static singleton.
  [ThreadStatic] private static SessionReference<MyStatics> _instance;
  
  // Previously static fields (or properties).
  public int Counter;

  // Session singleton.
  public MyStatics Instance
    => Application.GetInstance(ref _instance, () => new MyStatics());
    
  public static void DoSomething()
  {
    // was MyStatics.Counter++;
    MyStatics.Instance.Counter++;
  }
}

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LoadAssembly(nameOrFile)

Loads an assembly given the file name or path.

| Parameter      | Type                                                          | Description                                          |
| -------------- | ------------------------------------------------------------- | ---------------------------------------------------- |
| **nameOrFile** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file name or full path for the assembly to load. |

**Returns:** [Assembly](https://docs.microsoft.com/dotnet/api/system.reflection.assembly). The loaded [Assembly](https://docs.microsoft.com/dotnet/api/system.reflection.assembly).

This method loads the assembly and, if the assembly contains Wisej components that need embedded resources - like JavaScript classes or CSS styles - that are embedded in the assembly, notifies the client with the URL to load the additional resources dynamically.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LoadComponent(nameOrFile, className)

Creates an instance of the specified component from the assembly.

| Parameter      | Type                                                          | Description                                          |
| -------------- | ------------------------------------------------------------- | ---------------------------------------------------- |
| **nameOrFile** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file name or full path for the assembly to load. |
| **className**  | [String](https://docs.microsoft.com/dotnet/api/system.string) |                                                      |

**Returns:** [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent). An instance of a Wisej component implementing the [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) interface.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LoadPackages(packages, callback)

Loads the JavaScript files indicated in the *packages* list.

| Parameter                                                                                                                                                                                                                  | Type                                                                                                    | Description                                                                      |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **packages**                                                                                                                                                                                                               | [IEnumerable\<Package>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) | List of the JavaScript files to load.                                            |
| **callback** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action\<Boolean>](https://docs.microsoft.com/dotnet/api/system.action-1)                               | Optional callback returns whether all the scripts have been loaded successfully. |

Scripts are cached using the name specified in the [Package](https://github.com/iceteagroup/wisej-docs-api/blob/v4.0/api?q=wisej.web.widget.package) item and loaded only once.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LoadPackagesAsync(packages)

Loads the JavaScript files indicated in the *packages* list asynchronously.

| Parameter    | Type                                                                                                    | Description                           |
| ------------ | ------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| **packages** | [IEnumerable\<Package>](https://docs.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) | List of the JavaScript files to load. |

**Returns:** [Task\<Boolean>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1).

Scripts are cached using the name specified in the [Package](https://github.com/iceteagroup/wisej-docs-api/blob/v4.0/api?q=wisej.web.widget.package) item and loaded only once.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LoadTheme(name, mixins)

Changes the current theme.

| Parameter                                                                                                                                                                                                                | Type                                                              | Description                                                                                    |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| **name**                                                                                                                                                                                                                 | [String](https://docs.microsoft.com/dotnet/api/system.string)     | Name of the theme resource. Use only the name without the path and without the extension.      |
| **mixins** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | Optional list of theme mixin file names. If null, the default theme mixins are always applied. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) MapPath(path)

Returns the full file path in relation to the application's project directory.

| Parameter | Type                                                          | Description |
| --------- | ------------------------------------------------------------- | ----------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) |             |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The full path relative to the current application's root directory.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Navigate(url, target)

Navigate to the specified URL.

| Parameter                                                                                                                                                                                                                | Type                                                          | Description                                      |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | ------------------------------------------------ |
| **url**                                                                                                                                                                                                                  | [String](https://docs.microsoft.com/dotnet/api/system.string) | URL to navigate to.                              |
| **target** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [String](https://docs.microsoft.com/dotnet/api/system.string) | The target browser window: \_self, \_blank, etc. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Navigate(url, target, onclose)

Navigate to the specified URL in a new browser tab and receive an optional callback when the tab is closed.

| Parameter   | Type                                                          | Description                                                            |
| ----------- | ------------------------------------------------------------- | ---------------------------------------------------------------------- |
| **url**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | URL to navigate to.                                                    |
| **target**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The target browser window, cannot be \_self and cannot be empty.       |
| **onclose** | [Action](https://docs.microsoft.com/dotnet/api/system.action) | Callback function invoked when the browser tab is closed. Can be null. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) OpenWindow(url, target, windowFeatures, onclose)

Opens the specified URL in a browser's popup window and receive an optional callback when the tab is closed.

| Parameter          | Type                                                          | Description                                                                                                                                                                                                                                                            |
| ------------------ | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **url**            | [String](https://docs.microsoft.com/dotnet/api/system.string) | URL to navigate to.                                                                                                                                                                                                                                                    |
| **target**         | [String](https://docs.microsoft.com/dotnet/api/system.string) | The target browser window, cannot be \_self and cannot be empty.                                                                                                                                                                                                       |
| **windowFeatures** | [String](https://docs.microsoft.com/dotnet/api/system.string) | A string containing a comma-separated list of window features in the form name=value — or for boolean features, just name. These features include options such as the window's default size and position, whether or not to open a minimal popup window, and so forth. |
| **onclose**        | [Action](https://docs.microsoft.com/dotnet/api/system.action) | Callback function invoked when the browser popup window is closed. Can be null.                                                                                                                                                                                        |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Play(type)

Plays one of the built-in sounds

| Parameter | Type                                                                                                   | Description                                                                                                                                            |
| --------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **type**  | [MessageBoxIcon](https://docs.wisej.com/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon) | One of [MessageBoxIcon](https://docs.wisej.com/api/wisej.web/notifications/alertbox/wisej.web.messageboxicon) value that identifies the sound to play. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Play(soundUrl)

Plays a sound.

| Parameter    | Type                                                          | Description                                                         |
| ------------ | ------------------------------------------------------------- | ------------------------------------------------------------------- |
| **soundUrl** | [String](https://docs.microsoft.com/dotnet/api/system.string) | A string representing either a sound file URL or a base64 data URL. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Post(callback)

Executes the callback method after all processing is completed and before updating the client.

| Parameter    | Type                                                          | Description                                                                                     |
| ------------ | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| **callback** | [Action](https://docs.microsoft.com/dotnet/api/system.action) | Method to invoke after the request has completed but before sending the response to the server. |

The Post() method is similar to the BeginInvoke() method used by desktop applications. It allows you to execute a block of code out of sync with the current execution flow.

```csharp


void Test() {

  Application.Post(() => {
    this.listBox.Items.Add("1");
  });
  
  this.listBox.Items.Add("2");
  
  // The items will be added in this order: "2", "1".
}


```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Print(control)

Prints the specified control.

| Parameter   | Type                                                                                       | Description                                                        |
| ----------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------ |
| **control** | [IWisejControl](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcontrol) | The control to print, can be a window, a page or a single control. |

The control is printed without the caption or the borders, if present.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Print()

Prints the entire browser window.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) PromptAsync(message, defaultValue)

Instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.

| Parameter                                                                                                                                                                                                                      | Type                                                          | Description                                                                         |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| **message**                                                                                                                                                                                                                    | [String](https://docs.microsoft.com/dotnet/api/system.string) | A string of text to display to the user.                                            |
| **defaultValue** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [String](https://docs.microsoft.com/dotnet/api/system.string) | An optoional string containing the default value displayed in the text input field. |

**Returns:** [Task\<String>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task) that represents the asynchronous operation.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RefreshSessionId()

Generates a new session id without losing the session. <mark style="color:blue;background-color:green;">Since 3.5.2</mark>

Use this method after a successful login to prevent potential session fixation attacks.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Reload()

Causes the application to reload on the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RemoveEventFilter(filter)

Removes the filter from the list of registered event filters.

| Parameter  | Type                                                                                  | Description                                                                                                                                                   |
| ---------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **filter** | [IEventFilter](https://docs.wisej.com/api/wisej.core/general/wisej.core.ieventfilter) | An object that implements the [IEventFilter](https://docs.wisej.com/api/wisej.core/general/wisej.core.ieventfilter) interface to remove from the filter list. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RequestFullScreen()

Requests the browser to enable fullscreen mode if supported.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RunInContext(context, action)

Executes the callback in context.

| Parameter   | Type                                                                                           | Description                                                                                                                                                                                                          |
| ----------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **context** | [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) | The application context to update. It can be any Wisej component or the [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) returned by the property [Current](#current). |
| **action**  | [Action](https://docs.microsoft.com/dotnet/api/system.action)                                  | Function to execute in context. The code in the function can access all the static Application properties when executed from an out-of-bound thread.                                                                 |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) SetInstance\<T>(reference, instance)

Replaces the object assigned to a session-static singleton. <mark style="color:blue;background-color:green;">Since 3.5.2</mark>

| Parameter                                                                                                                                                                                                                | Type                                                                                                                     | Description                                        |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------- |
| **T**                                                                                                                                                                                                                    |                                                                                                                          | Type of the session-static object.                 |
| **reference** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-912a3bc068ac1c69bcaa58145e4ee468ccd8a555%2Fbadge-byref.svg?alt=media) | [SessionReference\<T>](https://docs.wisej.com/api/wisej.web/general/wisej.web.sessionreference-less-than-t-greater-than) | Thread-static reference to the *T* singleton.      |
| **instance**                                                                                                                                                                                                             | [T](https://docs.wisej.com/api/wisej.web/general/application)                                                            | New value to assign to the session-static storage. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) SetSessionTimeout(seconds)

Sets the current session timeout in seconds.

| Parameter   | Type                                                        | Description |
| ----------- | ----------------------------------------------------------- | ----------- |
| **seconds** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) |             |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartPolling(interval)

Instructs the client to start polling the server for UI changes at the specified *interval* when a WebSocket connection is not available.

| Parameter    | Type                                                        | Description                                              |
| ------------ | ----------------------------------------------------------- | -------------------------------------------------------- |
| **interval** | [Int32](https://docs.microsoft.com/dotnet/api/system.int32) | Polling interval in milliseconds. The minimum is 1000ms. |

Calling this method when [IsWebSocket](#iswebsocket) is true has no effect. Use client side polling when you know that your code will start a background task that needs to update the client asynchronously (push updates) and your server or clients don't support WebSocket connections. Once the background tasks are completed call [EndPolling](#endpolling) to reduce the incoming requests from the client.

```csharp


// this has not effect when the client and server are connected using WebSocket.
Application.StartPolling(1000);

Application.StartTask(() => {

  for (int i = 0; i < 100; i++) {
    this.label1.Text = "Counting..." + i;
    Thread.Sleep(1000);
  }
  
  // this has not effect when the client and server are NOT connected using WebSocket.
  Application.Update(this);

  // this has not effect when the client and server are connected using WebSocket.
  Application.EndPolling();

});

```

**Throws:**

* [ArgumentOutOfRangeException](https://docs.microsoft.com/dotnet/api/system.argumentoutofrangeexception) The *interval* specified is less than 1.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartTask(action)

Starts a new task within the current application context and returns immediately. See also [background-tasks](https://docs.wisej.com/docs/concepts/background-tasks).

| Parameter  | Type                                                          | Description                                             |
| ---------- | ------------------------------------------------------------- | ------------------------------------------------------- |
| **action** | [Action](https://docs.microsoft.com/dotnet/api/system.action) | Start method invoked by the new task when it starts up. |

**Returns:** [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task). An awaitable [Task](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task).

The task runs in the background but it's still capable of updating the client asynchronously when working with WebSocket by calling the [Update](#update-context-action) method to push the UI updates to the client browser. If you want to support background updates for clients or servers that can't use the WebSocket connection, you can either add a [Timer](https://docs.wisej.com/api/wisej.web/other-components/wisej.web.timer) component to the parent container to force period requests to the server, or you can use the [StartPolling](#startpolling-interval) and [EndPolling](#endpolling) methods.

```csharp

Application.StartTask(() => {

  for (int i = 0; i < 100; i++) {
  
    this.label1.Text = "Counting..." + i;
    
    // just wait a bit or it's too fast.
    Thread.Sleep(1000);
    Application.Update(this);
  }
});

```

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartTask\<T>(action)

Starts a new task with a return value within the current application context and returns immediately. See also [background-tasks](https://docs.wisej.com/docs/concepts/background-tasks).

| Parameter  | Type                                                            | Description                                             |
| ---------- | --------------------------------------------------------------- | ------------------------------------------------------- |
| **T**      |                                                                 |                                                         |
| **action** | [Func\<T>](https://docs.microsoft.com/dotnet/api/system.func-1) | Start method invoked by the new task when it starts up. |

**Returns:** [Task\<T>](https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1).

The task runs in the background but it's still capable of updating the client asynchronously when working with WebSocket by calling the [Update](#update-context-action) method to push the UI updates to the client browser. The generics overload of [StartTask](#starttask-action) allows the task to return a value. You can use this with the async/await pattern and asynchronously wait for the task to complete. If you want to support background updates for clients or servers that can't use the WebSocket connection, you can either add a [Timer](https://docs.wisej.com/api/wisej.web/other-components/wisej.web.timer) component to the parent container to force period requests to the server, or you can use the [StartPolling](#startpolling-interval) and [EndPolling](#endpolling) methods.

```csharp

string text = await Application.StartTask(() => {

  string value = "";
  for (int i = 0; i < 100; i++) {
  
    value += i.ToString();
    
    // just wait a bit or it's too fast.
    Thread.Sleep(100);
  }
  return value;
});

this.label.Text = text;
Application.Update(this);


```

Note that you don't have to specify the type in the angular brackets, the compiler will automatically detect the type from the return value of the asynchronous function.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) StartTimer(dueTime, period, callback)

Starts a [Timer](https://docs.microsoft.com/dotnet/api/system.threading.timer) bound to the current session context.

| Parameter    | Type                                                          | Description                                                                    |
| ------------ | ------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| **dueTime**  | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The amount of time, in milliseconds, to delay before invoking the *callback* . |
| **period**   | [Int32](https://docs.microsoft.com/dotnet/api/system.int32)   | The time interval between invocations, in milliseconds.                        |
| **callback** | [Action](https://docs.microsoft.com/dotnet/api/system.action) | A callback method to invoke at the specified intervals.                        |

**Returns:** [Timer](https://docs.microsoft.com/dotnet/api/system.threading.timer). An instance of [Timer](https://docs.microsoft.com/dotnet/api/system.threading.timer).

You must save a reference to the returned [Timer](https://docs.microsoft.com/dotnet/api/system.threading.timer) or the Garbage Collector will stop and dispose the timer. To alter the invocation period user Timer.Changer(), or stop the timer simply use Timer.Dispose(). See [system.threading](https://docs.microsoft.com/en-us/dotnet/api/system.threading.timer).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Update(context, action)

Executes the optional callback in context and pushes all the pending updates to the client when in WebSocket mode.

| Parameter                                                                                                                                                                                                                | Type                                                                                           | Description                                                                                                                                                                                                          |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **context**                                                                                                                                                                                                              | [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) | The application context to update. It can be any Wisej component or the [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) returned by the property [Current](#current). |
| **action** ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-723b640963c6cd781ff8c5ce5b24149fa0af7b9c%2Fbadge-optional.svg?alt=media) | [Action](https://docs.microsoft.com/dotnet/api/system.action)                                  | Function to execute in context. The code in the function can access all the static Application properties when executed from an out-of-bound thread.                                                                 |

Use this method when you need to update the client asynchronously from an out-of-bound thread (different thread, not originating from a client request). You can call this method at the end of the code that updates the UI:

```csharp

Application.StartTask(() => {

    for (int i = 0; i < 100; i++) {
    
      this.label1.Text = "Counting..." + i;
      
      // just wait a bit or it's too fast.
      Thread.Sleep(1000);
    }
    
    Application.Update(this);

});

```

Or you can use the optional *action* function to enclose the code that updates the UI in a block and ensure that the client is updated when the code block exits:

```csharp

Application.StartTask(() => {

    Application.Update(this, () => {
    
      for (int i = 0; i < 100; i++) {
    
        this.label1.Text = "Counting..." + i;
      
        // just wait a bit or it's too fast.
        Thread.Sleep(1000);
      }
    });

});

```

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ActiveWindowChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the active window changes.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ApplicationExit

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the application is about to shut down.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ApplicationRefresh

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the application is reloaded in the browser because the user hit refresh or changed the URL.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ApplicationStart

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the application is started, after the Main method is called.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) BeforeInstallPrompt

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the browser fires the "beforeinstallprompt" event. Corresponds to [BeforeInstallPromptEvent](https://developer.mozilla.org/en-US/docs/Web/API/BeforeInstallPromptEvent).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) BeginRequest

[RequestEventHandler](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.requesteventhandler) Fired at the beginning of every request.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) BrowserSizeChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the user resizes the browser.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) BrowserTabActivated

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the user activates the browser tab.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) BrowserTabDeactivated

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the user deactivates the browser tab.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) CultureChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [CurrentCulture](#currentculture) changes.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) EndRequest

[RequestEventHandler](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.requesteventhandler) Fired at the end of every request.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) FocusedControlChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the focused control changes.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) HashChanged

[HashChangedEventHandler](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.hashchangedeventhandler) Fired when the hash part of the URL changes on the client side.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) Idle

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the current thread has completed processing all the events and before the response is sent back to the client.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ImpersonationBegin

[HandledEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.handledeventhandler) Fired right after [ThreadBegin](#threadbegin), only when [Impersonate](https://docs.wisej.com/api/wisej.web/general/wisej.core.configuration#impersonate) is set to true, to allow user code to take over the thread impersonation operations.

Set e.Handled to true if your application takes care of impersonation; otherwise false to let the default implementation attempt to impersonate the user. This event is not related to a session. It is best to attach to this event from a static type initializer, otherwise each listener will be called for every thread, regardless of the session. The default implementation in Wisej.NET is supported only in .NET Framework and the Windows platform.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ImpersonationEnd

[HandledEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.handledeventhandler) Fired at the end of every request when impersonation is enabled in the JSON configuration file.

Set e.Handled to true if your application takes care of impersonation; otherwise false to let the default implementation attempt to impersonate the user. This event is not related to a session. It is best to attach to this event from a static type initializer, otherwise each listener will be called for every thread, regardless of the session. The default implementation in Wisej.NET is supported only in .NET Framework and the Windows platform.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) LicenseError

[LicenseErrorEventHandler](https://docs.wisej.com/api/wisej.web/general/application/wisej.web.licenseerroreventhandler) Fired when a license error occurs.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ResponsiveProfileChanged

[ResponsiveProfileChangedEventHandler](https://docs.wisej.com/api/wisej.web/general/control/wisej.web.responsiveprofilechangedeventhandler) Fired when the active responsive profile is changed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) RightToLeftChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the [RightToLeft](#righttoleft) value changes.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) SessionTimeout

[HandledEventHandler](https://docs.microsoft.com/dotnet/api/system.componentmodel.handledeventhandler) Fired when the session is about to time out.

The default behavior built-in Wisej is to display a dialog asking the user to prolong the session. Set Handled to true to stop the default behavior.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ThemeChanged

[EventHandler](https://docs.microsoft.com/dotnet/api/system.eventhandler) Fired when the current theme is changed.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-e4f8ed47a52590951f725a10c269555e81d41d81%2Fstatic.png?alt=media) ThreadException

[ThreadExceptionEventHandler](https://docs.microsoft.com/dotnet/api/system.threading.threadexceptioneventhandler) Fired when a thread exception is thrown.

## Implements

| Name                                                                                           | Description                                    |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------- |
| [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent) | All wisej components implement this interface. |
