語言

SessionStateStoreProviderBase.SetAndReleaseItemExclusive 方法

定義

更新會話狀態資料儲存中的會話項目資訊,並清除資料的鎖定。

public:
 abstract void SetAndReleaseItemExclusive(System::Web::HttpContext ^ context, System::String ^ id, System::Web::SessionState::SessionStateStoreData ^ item, System::Object ^ lockId, bool newItem);
public abstract void SetAndReleaseItemExclusive(System.Web.HttpContext context, string id, System.Web.SessionState.SessionStateStoreData item, object lockId, bool newItem);
abstract member SetAndReleaseItemExclusive : System.Web.HttpContext * string * System.Web.SessionState.SessionStateStoreData * obj * bool -> unit
Public MustOverride Sub SetAndReleaseItemExclusive (context As HttpContext, id As String, item As SessionStateStoreData, lockId As Object, newItem As Boolean)

參數

context
HttpContext

目前 HttpContext 的請求。

id
String

目前請求的會話識別碼。

item
SessionStateStoreData

SessionStateStoreData包含目前要儲存的會話值的物件。

lockId
Object

目前請求的鎖識別碼。

newItem
Boolean

true 將會話項目識別為新項目; false 將會話項目識別為現有項目。

範例

關於會話狀態儲存提供者實作的範例,請參見 實作 Session-State 儲存提供者。

備註

物件會在SessionStateModule請求結束時、事件期間SetAndReleaseItemExclusive呼叫該ReleaseRequestState方法,將目前的工作階段項目資訊插入資料儲存庫,或更新現有的會話項目資訊(包含當前值)、更新該項目的到期時間,並解除資料鎖定。 只有目前應用程式與所提供會話 id 及 lockId 數值相符的會話資料會被更新。 欲了解更多關於鎖定的資訊,請參閱類別總覽中的 SessionStateStoreProviderBase 「鎖定會話儲存資料」。

若目前請求的會話值未被修改,則 SetAndReleaseItemExclusive 該方法不會被呼叫。 取而代之的是呼叫該 ReleaseItemExclusive 方法。

如果 Abandon 方法已被呼叫,則 SetAndReleaseItemExclusive 該方法不會被呼叫。 取而代之的是,物件 SessionStateModule 呼叫 RemoveItem 該方法來從資料來源中刪除會話項目資料。

適用於

另請參閱