What is a Session Variable and why use it?
Every time a user visits a website, a new session is maintained for a specific period of time. During this session, the server records specific information about the user till the user logs out or closes the browser. The recorded sessions can be used throughout the website (pages) for specific reasons. This information can be stored using “Session Variables”.
E.g. Session(“mark”) = “a value”
The above example can be written in a variety of ways in a web page.
Design Mode (Asp.Net)
<% If Session("mark ") = “x” Then Some code here… Else And here… End If %>
Code behind
Protected Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmMemberList.Load If Session("mark ") = “x” Then Some code here… Else And here… End If End Sub
No comments:
Post a Comment