The Session State

ASP.NET provides the ability of holding per-user information via the Session object. When a user opens the website, ASP.NET creates a cookie with a session identifier and then manages the session for that user based on the ID. The only issue is that you have no way for understanding when the user leaves the website, so a Session state expires after 20 minutes as a default. The following is an example:

Session("MyKey") = "User level information" Dim userInfo As String = CStr(Session("MyKey"))

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.