ISession Interface

Definition

Stores user data while the user browses a web application. Session state uses a store maintained by the application to persist data across requests from a client. The session data is backed by a cache and considered ephemeral data.

public interface class ISession
public interface ISession
type ISession = interface
Public Interface ISession
Derived

Properties

Id

A unique identifier for the current session. This is not the same as the session cookie since the cookie lifetime may not be the same as the session entry lifetime in the data store.

IsAvailable

Indicate whether the current session has loaded.

Keys

Enumerates all the keys, if any.

Methods

Clear()

Remove all entries from the current session, if any. The session cookie is not removed.

CommitAsync()

Store the session in the data store. This may throw if the data store is unavailable.

CommitAsync(CancellationToken)

Store the session in the data store. This may throw if the data store is unavailable.

LoadAsync()

Load the session from the data store. This may throw if the data store is unavailable.

LoadAsync(CancellationToken)

Load the session from the data store. This may throw if the data store is unavailable.

Remove(String)

Remove the given key from the session if present.

Set(String, Byte[])

Set the given key and value in the current session. This will throw if the session was not established prior to sending the response.

TryGetValue(String, Byte[])

Retrieve the value of the given key, if present.

Extension Methods

Get(ISession, String)
GetInt32(ISession, String)
GetString(ISession, String)
SetInt32(ISession, String, Int32)
SetString(ISession, String, String)

Applies to