Saturday, September 7, 2013

Iska: Light-weight session handler for .NET

I read a very interesting novel this week. The title is Iska and it was written by late Cyprian Ekwensi, published in 1981. It tells the story of Filia, a simple young lady who after losing her husband, came down to Lagos and got caught-up in the enigma surrounding the State of Excellence. The story ends tragically when Filia loses her life as a result of activities of ritualists. Though it was sudden twist in the story, it wasn't unexpected because her mum had suspected her to be an Ogbanje. More details here:

I like the simplicity of the writing style and, being a Lagosian, the story was something I could relate to. So I stole the name of the book, Iska, for my Open-source .NET session management library.

Light-weight session handler for .NET
When I wrote this post:, I talked about my (unnecessary) over-emphasis on the statelessness of web services, and about stopping it by putting an extra authentication and authorization step with web service invocation. While trying to do this, I tried ASP.NET sessions (I built my web service on .NET, hosted on Azure) and discovered that it depended strongly on cookies deposited on users' browsers. This meant that if my web service was going to be invoked by a non-browser (say a mobile app), the session wouldn't be maintained.

To solve this problem, I created a very simple session manager, easy to initialize and use. Since first writing it, I've used it on a number projects. I use it for the simple purposes of authentication and authorisation -- which are the only states I maintain on the RAM. I thought it might be useful for someone else, so I cleaned it up and put it on my BitBucket.

  1. Easy to initialize and use.
  2. Automatically cleans-up your sessions periodically, at a duration you specify.
  3. Persist your session data periodically to any storage of your choice: file system, Windows Azure blob, database, etc. This prevents the loss of session on hardware/RAM crash. If you don't want to persist your sessions, it still works just fine.
The library is available here: Download it, add the DLL to your project and use it.

Possible improvements
If you want to go through the codes and work on it, please feel free to branch it and do whatever you like with it. I've identified some ways which it can be improved.
  1. The multithreading still seem quite tacky and could be improved on.
  2. It could do better with some generic type system introduced into the codes.
Please download, use and improve/extend it. Again, it can be found here: For how to use it, get codes for the sample console application I created:

It has been moved to my GitHub. The repository URL is

No comments: