แก้ไข

แชร์ผ่าน


ISessionIDManager.RemoveSessionID(HttpContext) Method

Definition

Deletes the session identifier from the cookie or from the URL.

public:
 void RemoveSessionID(System::Web::HttpContext ^ context);
public void RemoveSessionID (System.Web.HttpContext context);
abstract member RemoveSessionID : System.Web.HttpContext -> unit
Public Sub RemoveSessionID (context As HttpContext)

Parameters

context
HttpContext

The current HttpContext object that references server objects used to process HTTP requests (for example, the Request and Response properties).

Examples

The following code example implements the RemoveSessionID method.

public void RemoveSessionID(HttpContext context)
{
  context.Response.Cookies.Remove(pConfig.CookieName);
}
Public Sub RemoveSessionID(context As HttpContext) _
  Implements ISessionIDManager.RemoveSessionID

  context.Response.Cookies.Remove(pConfig.CookieName)

End Sub

Remarks

The SessionStateModule calls the RemoveSessionID method during the HttpApplication.ReleaseRequestState event to remove the session identifier from the HttpResponse.Cookies collection if a new session was created but was not used.

Applies to

See also