SignalR doesn’t use Session on server

SignalR connections (including the connection underlying all Hub operations for a client) do not support Session state. You could enable it if you wanted to but we’d strongly recommend against it as session state access serializes requests for a given client, meaning you won’t really get the benefit from SignalR duplex messaging anymore, as one … Read more

HTTP Session Tracking

As you mentioned, common ways to implement HTTP session tracking include URL rewriting and cookies. Session tracking basically requires that a session ID is maintained across multiple requests to the server. This means that each time a given client makes a request to the server, it passes the same session ID. The server can use … Read more

How to manage state in REST

There are 2 REST answers to this, depending on what specifically you are trying to do. If you are truly trying to manage request-based state (such as when a user is working through a multi-screen wizard or some other navigation-based workflow), then the REST answer is that state should be sent back-and-forth with each request/response … Read more

When the same user ID is trying to log in on multiple devices, how do I kill the session on the other device?

I came up with a pretty awesome solution to this. What I’ve implemented was when user “Bob” logs in from their PC, and then the same user “Bob” logs in from another location, the log-in from the first location (their PC) will be killed while allowing the second log-in to live. Once a user logs … Read more

Session.Clear() vs. Session.RemoveAll()

They are absolutely the same. RemoveAll calls Clear internally. From Reflector: public sealed class HttpSessionState : ICollection, IEnumerable { … [TargetedPatchingOptOut(“Performance critical to inline this type of method across NGen image boundaries”)] public void RemoveAll() { this.Clear(); } … }