ISession Interface¶
- Namespace
Microsoft.AspNetCore.Http
- Assemblies
- Microsoft.AspNetCore.Http.Features
Methods¶
-
Clear
()¶ Remove all entries from the current session, if any. The session cookie is not removed.
void Clear()
-
CommitAsync
()¶ Store the session in the data store. This may throw if the data store is unavailable.
Return type: System.Threading.Tasks.Task Task CommitAsync()
-
LoadAsync
()¶ Load the session from the data store. This may throw if the data store is unavailable.
Return type: System.Threading.Tasks.Task Task LoadAsync()
-
Remove
(System.String)¶ Remove the given key from the session if present.
void Remove(string key)
-
Set
(System.String, System.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.
void Set(string key, byte[] value)
-
TryGetValue
(System.String, out System.Byte[])¶ Retrieve the value of the given key, if present.
Return type: System.Boolean bool TryGetValue(string key, out byte[] value)
-
Properties¶
-
Microsoft.AspNetCore.Http.ISession.
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.
Return type: System.String string Id { get; }
-
Microsoft.AspNetCore.Http.ISession.
IsAvailable
¶ Indicate whether the current session has loaded.
Return type: System.Boolean bool IsAvailable { get; }
-
Microsoft.AspNetCore.Http.ISession.
Keys
¶ Enumerates all the keys, if any.
Return type: System.Collections.Generic.IEnumerable<System.String> IEnumerable<string> Keys { get; }
-