ibiza ibiza - 1 year ago 382
HTTP Question

What is the equivalent of HttpContext.GetOwinContext() from a Hub?

I made a OWIN SignalR server self-hosted in a console app.

From an example that is hosting SignalR in a ASP.NET MVC application instead (in IIS), I see this line of code:

var authenticateResult = await HttpContext.GetOwinContext().Authentication.AuthenticateAsync("ExternalCookie");

I do not have access to
in my console app (and do not want to reference the System.Web.Mvc assembly if possible). What would be the equivalent of
in my SignalR hub class?

Answer Source

Nuget package:


In Configuration:


In hub:

new Microsoft.Owin.OwinContext(OwinRequestScopeContext.Current.Environment)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download