Querying session data when using StateServer service

2.1k views Asked by At

Does anybody know of a way to query across all active sessions when using StateServer service in a .NET 4.0 web app?

In my scenario, I am setting a piece of session data when the user navigates to one of our partner sites. The partner site then periodically calls a service on our site which verifies if the session is still active and returns some other data.

I managed to get it working when I was initially using InProc sessions using the solutions outlined in: List all active ASP.NET Sessions, however when I switched to using StateServer service, these techniques don't work and I can't query the sessions.

Any ideas?

Many thanks

1

There are 1 answers

0
Niranjan Singh On BEST ANSWER

I suggest you to go through this article - Counting the Currently Active Sessions

The session state is stored in a database called ASPState. The database includes several stored procedures and creates a couple of tables to the TempDB database. The tables are called ASPStateTempApplications and ASPStateTempSessions. Knowing how many sessions are currently active is as easy as running a SELECT against the AspStateTempSessions table. If the session is working in StateServer mode, none of these tricks will work.

Reference: Session State Management
The ASP.NET Sessions Active counter (NOT State Server) shows invalid number after installing .NET 3.5 SP!
Count Active Sessions in ASP.Net, some what same as the link you specified in the question.