Session.Add("username", "johnDoe");
Person person = new Person(); person.Name = "John Doe"; person.Age = 30; Session.Add("personDetails", person);In this example, we are creating a custom object "Person" and adding it to the session object with the key "personDetails". Package library: System.Web.HttpSessionState.