Interface ISessionManager
Represents a session manager, which is in charge of managing session objects and their association to HTTP contexts.
Namespace: EmbedIO.Sessions
Syntax
public interface ISessionManager
Methods
Create(IHttpContext)
Returns the session associated with an IHttpContext. If a session ID can be retrieved for the context and stored session data are available, the returned ISession will contain those data; otherwise, a new session is created and its ID is stored in the response to be retrieved by subsequent requests.
Declaration
ISession Create(IHttpContext context)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | The HTTP context. |
Returns
Type | Description |
---|---|
ISession | An ISession interface. |
Delete(IHttpContext)
Deletes the session (if any) associated with the specified context.
Declaration
void Delete(IHttpContext context)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | The HTTP context. |
See Also
OnContextClose(IHttpContext)
Called by a session proxy when a session has been obtained for an IHttpContext and the context is closed, even if the session was subsequently deleted.
This method can be used to save session data to a storage medium.
Declaration
void OnContextClose(IHttpContext context)
Parameters
Type | Name | Description |
---|---|---|
IHttpContext | context | The IHttpContext for which a session was obtained. |
Start(CancellationToken)
Signals a session manager that the web server is starting.
Declaration
void Start(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The cancellation token used to stop the web server. |