'Assign a custom key to a session in c#

I'm building a .NET 6 Core MVC Application In which I want to create a session whose key is "customer". And then I want to check on each page whether that session is valid or not. How can I do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source