Summary
Provides functionality to track a session ID in HTTP requests using cookies.
Remarks
This class only retrieves session IDs from the session cookie and does not handle mapping IDs to session data. It also
does not automatically create a new session if the HTTP response did not contain a session cookie.
Constructors
|
Constructs a new instance. |
Static methods
string | | Returns a random string of 32 characters useful as a session ID. |
Instance methods
void | |
Specifies that the session cookie should be deleted by the Handle method. Its value is false initially and right
after calling Handle(). |
HttpResponse | |
Retrieves the session ID from the session cookie (specified by the cookie name) from the given HttpRequest and calls the handler function. A session cookie is added to the HTTP
response returned by the handler only if either SimpleSession.DeleteSession() or SimpleSession.NewSession(string, DateTime?, string) have been
called (possibly by the handler). Before the possibly augmented HTTP response is returned, the status of
DeleteSession and NewSession is reset. |
void | NewSession(string sessionID, DateTime? cookieExpiry, string cookiePath = "/") |
Specifies that a new session should be created. (The SimpleSession.Handle(HttpRequest, Func<HttpResponse>) method adds the relevant cookie to the
HTTP response.) It also sets the current SessionID to the specified ID. |
Instance properties
DateTime? | | The expiry date of the retrieved session cookie. If null, the session expires when the client's browser closes. |
string | | The name of the cookie that contains the session ID. |
string | | The path of the retrieved session cookie. |
string | | The session ID retrieved from the session cookie. |