Typed session data in ASP.NET made easier still
- đź“…
- đź“ť 289 words
- đź•™ 2 minutes
- 📦 .NET
- 🏷️ ASP.NET, C#
- đź’¬ 5 responses
Philippe Leybaert is unimpressed with Microsoft’s Web Client Software Factory approach for typed session data and offers his own Typed session data made (very) easy which still seems overkill to me comprising as it does of generics, a delegate a helper class to achieve the desired effect. (Whilst you are there check out his very interesting MVC project for ASP.NET called ProMesh)
The solution which I have been using since my .NET 1.1 days is much simpler still and involves nothing more than creating a plain class with properties for every session variable and a static get accessor that obtains or creates it on the HttpContext similar to a singleton.