SessionIDManager.SaveSessionID(HttpContext, String, Boolean, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Saves a newly created session identifier to the HTTP response.
public:
virtual void SaveSessionID(System::Web::HttpContext ^ context, System::String ^ id, [Runtime::InteropServices::Out] bool % redirected, [Runtime::InteropServices::Out] bool % cookieAdded);
public void SaveSessionID (System.Web.HttpContext context, string id, out bool redirected, out bool cookieAdded);
abstract member SaveSessionID : System.Web.HttpContext * string * bool * bool -> unit
override this.SaveSessionID : System.Web.HttpContext * string * bool * bool -> unit
Public Sub SaveSessionID (context As HttpContext, id As String, ByRef redirected As Boolean, ByRef cookieAdded As Boolean)
Parameters
- context
- HttpContext
The current HttpContext object that references server objects used to process HTTP requests (for example, the Request and Response properties).
- id
- String
The session identifier.
- redirected
- Boolean
When this method returns, contains a Boolean value that is true
if the response is redirected to the current URL with the session identifier added to the URL; otherwise, false
.
- cookieAdded
- Boolean
When this method returns, contains a Boolean value that is true
if a cookie has been added to the HTTP response; otherwise, false
.
Implements
Exceptions
The response has already been sent.
-or-
The session ID passed to this method failed validation.
Remarks
This method is not intended to be called from application code.
The SaveSessionID method is called by the SessionStateModule object during the AcquireRequestState event. The SaveSessionID method stores the session identifier in either the URL (when cookieless session state is used) or in a non-expiring session cookie.
By default, the SessionIDManager places a unique session identifier into a non-expiring session cookie and sets the cookieAdded
parameter to true
.
For a cookieless session state, the SessionIDManager object inserts a unique session identifier into the current URL, redirects the browser to the new URL that includes the session identifier, and then sets the redirected
parameter to true
.