Sessions in ASP.NET are simply hash tables in the memory with a timeout specified.
Session
(“username”) = “Aayush Puri”
Session(“color”) = “Blue”
Sessions in ASP.NET are identified using 32-bit long integers known as Session IDs. The ASP engine generates these session ID’s so that uniqueness is guaranteed.
Session Type | What it does | Example |
Session.Abandon | Abandons (cancels) the current session. |
|
Session.Remove | Delete an item from the session-state collection. | Session(“username”) = “Aayush Puri” Session.Remove(“username”) |
Session.RemoveAll | Deletes all session state items |
|
Session.Timeout | Set the timeout (in minutes) for a session | Session.Timeout=30 (If a user does NOT request a page of the ASP.NET application within 30 minutes then the session expires.) |
Session.SessionID | Get the session ID (read only property of a session) for the current session. |
|
Session.IsNewSession | This is to check if the visitor’s session was created with the current request i.e. has the visitor just entered the site. The IsNewSession property is true within the first page of the ASP.NET application. |
|
No comments:
Post a Comment