You can store user-specific information, such as a user's name, in the Session collection.
Because the Session collection is user specific, it should not be written to by multiple
threads concurrently.Therefore, you do not need to use locks around your writes, as you
must with the Application collection . Otherwise, the syntax is similar:
Session("UserName")=UserNameTextBox.Text
UserNameLabel.Text = Session("UserName")
Comments
By default, the Session collection holds data for 20 minutes after the last request to an
application by a particular user.You can adjust this time period in the application's con-
figuration . Because data stored in sessions can grow linearly with the
number of users, and because it persists for quite some time after each user leaves, it can
quickly impede scalability if it is used to store large amounts of data. It should therefore
be used sparingly.
No comments:
Post a Comment