When I try to access the HttpContext
current session from the HUB it returns null
.
I tried making use of the interface IRequiresSession
but it didn't work. Can someone help me?
When I try to access the HttpContext
current session from the HUB it returns null
.
I tried making use of the interface IRequiresSession
but it didn't work. Can someone help me?
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 request will block the other e.g. in the long polling transport, the receiving connection will block any attempt to send.
SessionState
trap when used it with SignalR
: https://mcmap.net/q/454866/-signalr-serversentevents-on-windows-server-2008-with-iis-7-post-request-taking-too-much-time-to-complete/114029 Hey Damian: can you tell me if this recommendation of not using SessionState
is included in SignalR docs? It'd be good to put it there in the forefront as a WARNING! :) –
Snigger you can simply maintain your own session, for example, use in memory cache, http is stateless,so server need session to maintain clients,but web socket is keep-alive connection, server keeps connected with clients, by default no need such things like HttpContext Session.
I resolve the same problem with hidden field as follows:
© 2022 - 2024 — McMap. All rights reserved.