In this article I will explain with an example, how to store (save) class object in Session in ASP.Net using C# and VB.Net.
Property Class
The class consists of following properties.
public class Person
    public string Name { get; set; }       
    public int Age { get; set; }
Public Class Person
    Public Property Name As String
    Public Property Age As Integer
End Class
Storing class object in Session
Inside the Page Load event handler, an object of the Person class is created and values of Name and Age properties are set.
Finally, the person object is set in the Session.
protected void Page_Load(object sender, EventArgs e)
    Person person = new Person()
        Name = "Mudassar Khan",
        Age = 35
    Session["Person"] = person;
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim person As Person = New Person() With {
        .Name = "Mudassar Khan",
        .Age = 35
    Session("Person") = person
End Sub
Store (Save) Class Object in Session in ASP.Net using C# and VB.Net