Share via


ISessionStore.Create Method

Definition

Overloads

Create(String, TimeSpan, Func<Boolean>, Boolean)
Create(String, TimeSpan, TimeSpan, Func<Boolean>, Boolean)

Create a new or resume an ISession.

Create(String, TimeSpan, Func<Boolean>, Boolean)

public:
 Microsoft::AspNetCore::Http::ISession ^ Create(System::String ^ sessionKey, TimeSpan idleTimeout, Func<bool> ^ tryEstablishSession, bool isNewSessionKey);
public Microsoft.AspNetCore.Http.ISession Create (string sessionKey, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey);
abstract member Create : string * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
Public Function Create (sessionKey As String, idleTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), isNewSessionKey As Boolean) As ISession

Parameters

sessionKey
String
idleTimeout
TimeSpan
tryEstablishSession
Func<Boolean>
isNewSessionKey
Boolean

Returns

Applies to

Create(String, TimeSpan, TimeSpan, Func<Boolean>, Boolean)

Source:
ISessionStore.cs

Create a new or resume an ISession.

public:
 Microsoft::AspNetCore::Http::ISession ^ Create(System::String ^ sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> ^ tryEstablishSession, bool isNewSessionKey);
public Microsoft.AspNetCore.Http.ISession Create (string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey);
abstract member Create : string * TimeSpan * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
Public Function Create (sessionKey As String, idleTimeout As TimeSpan, ioTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), isNewSessionKey As Boolean) As ISession

Parameters

sessionKey
String

A unique key used to lookup the session.

idleTimeout
TimeSpan

How long the session can be inactive (e.g. not accessed) before it will expire.

ioTimeout
TimeSpan

The maximum amount of time LoadAsync(CancellationToken) and CommitAsync(CancellationToken) are allowed take.

tryEstablishSession
Func<Boolean>

A callback invoked during Set(String, Byte[]) to verify that modifying the session is currently valid. If the callback returns false, Set(String, Byte[]) should throw an InvalidOperationException. SessionMiddleware provides a callback that returns false if the session was not established prior to sending the response.

isNewSessionKey
Boolean

true if establishing a new session; false if resuming a session.

Returns

The ISession that was created or resumed.

Applies to