ASP.NET State Management and Sql Server

There are a few ways to keep your session in ASP.NET. One of those ways is to setup Sql Server for state management. It is a little slower than storing state in the webserver’s memory, but it will work in a web farm scenario where the other won’t. I’d never actually set up session to work that way in an ASP.NET app before, so I tried it the other day.

Frankly, it just shouldn’t be that easy. Seriously. All it took was running a script on my database and changing the web.config. Really, that’s it. No code changes. Nothing complicated. Just run a script and change a line of xml. This is one thing I really like about .NET. It allows you to do focus more on building the application than having to worry about every detail of the plumbing. Cool stuff.

There are other ways of dealing with session in a web farm environment. This is one really great way of doing it. I highly recommend it.