Codecore Logo
Quick Search
»
Advanced Search »

Application Object

RSS
Enables sharing of global information across multiple sessions and requests within an web application.


Instance Properties

Count

Gets the number of objects in the application state collection.

Accessibility : Read Only

Type: Number

Instance Methods

Add

Adds a new object to the application state collection.

Syntax:

void Add( String name, Object value)

Parameters:

name: The name of the object to be added to the collection.

value: The value of the object.

Example:


Application.Add("UserName", "John Doe");

Clear

Removes all objects from an application state collection.

Syntax:

void Clear()

Example:


Application.Clear();

Get ( Number )

Gets an application state object by numerical index.

Syntax:

Object Get( Number index )

Parameters:

index: The index of the application state object.

Return Value:

The object referenced by index.

Example:


x = Application.Get( 1 );

Get ( String )

Gets an application state object by name.

Syntax:

Object Get( String name )

Parameters:

name: The name of the object.

Return Value:

The object referenced by name.

Example:


username = Application.Get( "UserName" );

Lock

Locks access to an application state variable to facilitate access synchronization.

Syntax:

void Lock()

Example:


Application.Lock();
Application.Update("MyCount", Application.Get("MyCount") + 1);
Application.UnLock();

Remove

Removes the named object from an application state collection.

Syntax:

void Remove( String name )

Parameters:

name: The name of the object to be removed from the collection.

Example:


Response.Remove("UserName");

RemoveAll

Removes all objects from an application state collection.

Syntax:

void RemoveAll( )

Example:


Application.RemoveAll();

RemoveAt ( Number )

Removes an application state object from a collection by index.

Syntax:

void RemoveAt( Number index )

Parameters:

index: The position in the collection of the item to remove.

Example:


x = Application.RemoveAt( 1 );

Set ( String, Object )

Updates the value of an object in an HttpApplicationState collection.

Syntax:

void Set( String name, Object value )

Parameters:

name: The name of the object to be updated.

value: The updated value of the object.

Example:


x = Application.Set( "MyValue", 12 );

UnLock

Unlocks access to an application state variable to facilitate access synchronization.

Syntax:

void UnLock()

Example:


Application.Lock();
Application.Update("MyCount", Application.Get("MyCount") + 1);
Application.UnLock();

See Also

Request Object
Response Object
Server Object
Session Object
Privacy Policy | Conditions Of Use

Copyright ©2014 Codecore Technologies, All rights reserved.