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.


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.


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

as the entering point to find out the best solution.

链接地址: http://www.djcxy.com/p/41154.html

上一篇: 用户认证使用Backbonejs和SLIM框架

下一篇: ASP.NET WebApi 2获取服务器中的所有活动会话(用户)