Link to home
Start Free TrialLog in
Avatar of jxbma
jxbmaFlag for United States of America

asked on

Why is my HTTPContext.Current.Session null when using SignalR 2.x libraries in our ASP .Net MVC application?

Hi:

I'm attempting to migrate our ASP.Net MVC application from using Signal R1.x tgo SignalR 2.x.  I just found issue which will certainly cause us problems in our quest to move forward.

Our web application is MVC based and makes heavy use of the HttpContext.Current.Session variable.
When running with SignalR 1.x, everything is fine and dandy with Session.

When we upgraded to SignalR 2.x, Session was suddenly null.

I did a little googling and found the following links regarding the issue:
http://stackoverflow.com/questions/20881591/httpcontext-current-session-is-nul-in-signalr-need-alternate-to-session-state

Further investigation revealed the following tidbit of information:
http://www.asp.net/signalr/overview/signalr-20/troubleshooting-and-debugging/troubleshooting

HTTPContext.Current.Session is null
This behavior is by design. SignalR does not support the ASP.NET session state, since enabling the session state would break duplex messaging.

Open in new window


I would imagine that this will break a great many ASP .Net MVC based applications.
Is there any workaround for this?

Is this truly by design, or is it a result of using oWin::>Startup::Configuration(){app.MapSignalR();} to initiate signalR in 2.x?

If possible, I’d like to figure this out and if the solution is not so painful, they will still consider moving to 2.x.

Thoughts?

Thanks in advance for your time,
JohnB
ASKER CERTIFIED SOLUTION
Avatar of jxbma
jxbma
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jxbma

ASKER

Researched the issue myself and found the answers I was looking for.

JB