views:

406

answers:

4

What is the best way to maintain a user's session state in an ASP.NET MVC app hosted on a web farm?

Out application currently uses the standard ASP.NET session on IIS 6.0 but we want to move the app to a web farm environment. I have read that we can use SQL Server session state for our application but I just want to know if anybody was using something else and why!

A: 

You could try storing your sessions in memcache. Should be both fast and scalable. It does require some memory though.

Runeborg
A: 

As discussed in one of the StackOverflow podcasts: usually session state is very minimal - a few keys here and there - and works well to simply store this in a central database.

xanadont
+3  A: 

One way would be to use the Velocity distributed cache.

Craig Stuntz
Sadly it's not released yet, it is just in CTP. But I agree, when Velocity is released, it should become the premier way of distributing session state across Windows based HTTP servers.
Jesper Mortensen
A: 

Storing session in SQL is still valid in MVC (as it was in WebForms):

http://support.microsoft.com/kb/317604

We're using it successfully across a few boxes for our MVC app, and have used it across quite a few boxes for older WebForms apps.

Darrell Mozingo