ISession 介面

定義

當使用者流覽 Web 應用程式時儲存使用者資料。 會話狀態會使用應用程式所維護的存放區,在來自用戶端的要求之間保存資料。 會話資料是由快取所支援,並視為暫時資料。

public interface class ISession
public interface ISession
type ISession = interface
Public Interface ISession
衍生

屬性

Id

目前會話的唯一識別碼。 這與會話 Cookie 不同,因為 Cookie 存留期可能與資料存放區中的會話專案存留期不同。

IsAvailable

指出目前會話是否已順利載入。 在載入會話之前存取此屬性會導致內嵌載入它。

Keys

列舉所有索引鍵,如果有的話。

方法

Clear()

如果有的話,請從目前的會話中移除所有專案。 會話 Cookie 不會移除。

CommitAsync()

將資料存放區中的會話儲存在資料存放區中。 如果資料存放區無法使用,可能會擲回此資料存放區。

CommitAsync(CancellationToken)

將資料存放區中的會話儲存在資料存放區中。 如果資料存放區無法使用,可能會擲回此資料存放區。

LoadAsync()

從資料存放區載入會話。 如果資料存放區無法使用,可能會擲回此資料存放區。

LoadAsync(CancellationToken)

從資料存放區載入會話。 如果資料存放區無法使用,可能會擲回此資料存放區。

Remove(String)

如果有的話,請從會話中移除指定的金鑰。

Set(String, Byte[])

在目前的會話中設定指定的索引鍵和值。 如果在傳送回應之前未建立會話,這會擲回。

TryGetValue(String, Byte[])

如果有的話,擷取指定索引鍵的值。

擴充方法

Get(ISession, String)

ISession 取得位元組陣列值。

GetInt32(ISession, String)

ISession 取得 int 值。

GetString(ISession, String)

ISession 取得字串值。

SetInt32(ISession, String, Int32)

在 中設定 int ISession 值。

SetString(ISession, String, String)

String設定 中的 ISession 值。

適用於