Taras Kovalenko
Taras Kovalenko

Reputation: 2393

ASP.NET WebApi 2 get all active sessions (users) in the server

I have a server on the WebApi2, and I need get all active users on the server. How to implement it? I think, maybe, save customerId after logIn in the session storage. But I don't know how to implement it.

Or maybe exists some best solutions for it. Help me please, with this issue.

Upvotes: 1

Views: 1821

Answers (2)

Benjamin Soulier
Benjamin Soulier

Reputation: 2263

You can access session object using this kind of code.

Keep in mind that Web API provides REST services, and is from a design perpective not meant to access Session objects, as its purpose is to provide stateless methods.

This of course does not mean it is not technically feasible, as you can see on this SO answer.

Upvotes: 1

garik
garik

Reputation: 5756

Use this article Adding Session support to ASP.NET Web API for example

as the entering point to find out the best solution.

Upvotes: 1

Related Questions