HttpSessionStateWrapper Class

Definition

Encapsulates the HTTP intrinsic object that provides access to session-state values, session-level settings, and lifetime management methods.

C#
public class HttpSessionStateWrapper : System.Web.HttpSessionStateBase
Inheritance
HttpSessionStateWrapper

Remarks

The HttpSessionStateWrapper class derives from the HttpSessionStateBase class and serves as a wrapper for the HttpSessionState class. This class exposes the functionality of the HttpSessionState class and exposes the HttpSessionStateBase type. The HttpSessionStateBase class lets you replace the original implementation of the HttpSessionState class in your application with a custom implementation, such as when you perform unit testing outside the ASP.NET pipeline.

Constructors

HttpSessionStateWrapper(HttpSessionState)

Initializes a new instance of the HttpSessionStateWrapper class.

Properties

CodePage

Gets or sets the character-set identifier for the current session.

Contents

Gets a reference to the current session-state object.

CookieMode

Gets a value that indicates whether the application is configured for cookieless sessions.

Count

Gets the number of items in the session-state collection.

IsCookieless

Gets a value that indicates whether the session ID is embedded in the URL.

IsNewSession

Gets a value that indicates whether the session was created during the current request.

IsReadOnly

Gets a value that indicates whether the session is read-only.

IsSynchronized

Gets a value that indicates whether access to the collection of session-state values is synchronized (thread safe).

Item[Int32]

Gets or sets a session value by using the specified index.

Item[String]

Gets or sets a session value by using the specified name.

Keys

Gets a collection of the keys for all values that are stored in the session-state collection.

LCID

Gets or sets the locale identifier (LCID) of the current session.

Mode

Gets the current session-state mode.

SessionID

Gets the unique identifier for the session.

StaticObjects

Gets a collection of objects that are declared by object elements that are marked as server controls and scoped to the current session in the application's Global.asax file.

SyncRoot

Gets an object that can be used to synchronize access to the collection of session-state values.

Timeout

Gets or sets the time, in minutes, that can elapse between requests before the session-state provider ends the session.

Methods

Abandon()

Cancels the current session.

Add(String, Object)

Adds an item to the session-state collection.

Clear()

Removes all keys and values from the session-state collection.

CopyTo(Array, Int32)

Copies the collection of session-state values to a one-dimensional array, starting at the specified index in the array.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEnumerator()

Returns an enumerator that can be used to read all the session-state variable names in the current session.

GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Remove(String)

Deletes an item from the session-state collection.

RemoveAll()

Removes all keys and values from the session-state collection.

RemoveAt(Int32)

Deletes the item at the specified index from the session-state collection.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Extension Methods

Cast<TResult>(IEnumerable)

Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

Enables parallelization of a query.

AsQueryable(IEnumerable)

Converts an IEnumerable to an IQueryable.

Applies to

Product Versions
.NET Framework 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1