Question

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!

Was it helpful?

Solution

One way would be to use the Velocity distributed cache.

OTHER TIPS

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.

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

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top