HttpConnectionContextExtensions.GetHttpContext(ConnectionContext) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the HttpContext associated with the connection, if there is one.
public:
[System::Runtime::CompilerServices::Extension]
static Microsoft::AspNetCore::Http::HttpContext ^ GetHttpContext(Microsoft::AspNetCore::Connections::ConnectionContext ^ connection);
public static Microsoft.AspNetCore.Http.HttpContext GetHttpContext (this Microsoft.AspNetCore.Connections.ConnectionContext connection);
public static Microsoft.AspNetCore.Http.HttpContext? GetHttpContext (this Microsoft.AspNetCore.Connections.ConnectionContext connection);
static member GetHttpContext : Microsoft.AspNetCore.Connections.ConnectionContext -> Microsoft.AspNetCore.Http.HttpContext
<Extension()>
Public Function GetHttpContext (connection As ConnectionContext) As HttpContext
Parameters
- connection
- ConnectionContext
The ConnectionContext representing the connection.
Returns
The HttpContext associated with the connection, or null
if the connection is not HTTP-based.
Remarks
SignalR connections can run on top of HTTP transports like WebSockets or Long Polling, or other non-HTTP transports. As a result, this method can sometimes return null
depending on the configuration of your application.