Answer: It's easy to retrieve values from Session Variables.
Note:-Always check Null before retrieving values from Session otherwise exception occurs.
For Example:-
In C#,
string name = string.Empty;
if (Session["Name"] != null)
{
name = Convert.ToString(Session["Name"]);
}
In VB.Net,
Dim name As String = String.Empty
If (Not Session("Name") Is Nothing) Then
name = Convert.ToString(Session("Name"))
End If
Asked In: Many Interviews |
Alert Moderator