The most important thing about the Session object is that you can store variables in it.
The example below will set the Session variable username to "Donald Duck" and the Session variable age to "50":
<%
Session("username")="Donald Duck"
Session("age")=50
%>
Session("username")="Donald Duck"
Session("age")=50
%>
When the value is stored in a session variable it can be reached from ANY page in the ASP application:
Welcome <%Response.Write(Session("username"))%>
The line above returns: "Welcome Donald Duck".
You can also store user preferences in the Session object, and then access that preference to choose what page to return to the user.
The example below specifies a text-only version of the page if the user has a low screen resolution:
<%If Session("screenres")="low" Then%>
This is the text version of the page
<%Else%>
This is the multimedia version of the page
<%End If%>
This is the text version of the page
<%Else%>
This is the multimedia version of the page
<%End If%>
Practice Excercise Practice now