In this article, I will talk about a Sitecore Shared Sessions configuration. Many times when you deploy your changes to production environment. You will notice that the application pool was recycled. To avoid this problem, you can configure Redis to store the user’s sessions.

This configuration is pretty simple you will need to follow this walkthrough.

Once you enabled shared sessions using Redis you will notice when you deploy your new releases, the users that are navigating to your website don’t required to enter their credentials again.

But following this approach, as developer you will need to take care about the models that you are building for use as session variables.

[Serializable]
    public class Location
    {
        [RawValueOnly]
        public ID ID { get; set; }
        [RawValueOnly]
        public string CountryCode { get; set; }
        [RawValueOnly]
        public string CountryName { get; set; }

        [RawValueOnly]
        public string City { get; set; }

    }

In the example, Imagine that you want to store a location variable into your session. You would need to create a class but the important thing here is do not forget to include [Serializable].

If you do not serialize your model, once you want to retrieve your session variable website will crash.

I hope this information will be useful for you.