Soenneker.Extensions.IHttpContextAccessors
11.0.167
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Extensions.IHttpContextAccessors --version 11.0.167
NuGet\Install-Package Soenneker.Extensions.IHttpContextAccessors -Version 11.0.167
<PackageReference Include="Soenneker.Extensions.IHttpContextAccessors" Version="11.0.167" />
<PackageVersion Include="Soenneker.Extensions.IHttpContextAccessors" Version="11.0.167" />
<PackageReference Include="Soenneker.Extensions.IHttpContextAccessors" />
paket add Soenneker.Extensions.IHttpContextAccessors --version 11.0.167
#r "nuget: Soenneker.Extensions.IHttpContextAccessors, 11.0.167"
#:package Soenneker.Extensions.IHttpContextAccessors@11.0.167
#addin nuget:?package=Soenneker.Extensions.IHttpContextAccessors&version=11.0.167
#tool nuget:?package=Soenneker.Extensions.IHttpContextAccessors&version=11.0.167
Soenneker.Extensions.IHttpContextAccessors
Extension methods for retrieving common request and connection data through an injected IHttpContextAccessor.
Installation
dotnet add package Soenneker.Extensions.IHttpContextAccessors
Usage
Register the ASP.NET Core accessor once:
builder.Services.AddHttpContextAccessor();
Then read the address while an HTTP request is active:
using Soenneker.Extensions.IHttpContextAccessors;
string? clientIp = httpContextAccessor.GetRequestIp();
GetRequestIp() delegates to the companion HttpContext extension. It uses a valid CF-Connecting-IP address first, then a valid first address from X-Forwarded-For, then the connection's remote IP. Malformed header values are ignored. It returns null when there is no active HttpContext or no address can be found.
Forwarded headers are caller-controlled unless your proxy and ASP.NET Core forwarded-header configuration establish trust. Do not treat the returned text as authenticated identity by itself.
IHttpContextAccessor.HttpContext is request-flow state. Call this extension when the value is needed; do not capture the HttpContext for later background work. If a background operation needs the address, copy the returned string into the work item while handling the request.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Extensions.HttpContext (>= 11.0.792)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.183 | 0 | 12/3/2026 |
| 11.0.182 | 46 | 12/3/2026 |
| 11.0.181 | 48 | 12/2/2026 |
| 11.0.180 | 52 | 12/2/2026 |
| 11.0.179 | 48 | 12/2/2026 |
| 11.0.178 | 49 | 12/2/2026 |
| 11.0.177 | 47 | 12/2/2026 |
| 11.0.175 | 68 | 12/2/2026 |
| 11.0.174 | 70 | 12/1/2026 |
| 11.0.173 | 61 | 12/1/2026 |
| 11.0.172 | 53 | 12/1/2026 |
| 11.0.171 | 51 | 12/1/2026 |
| 11.0.170 | 59 | 12/1/2026 |
| 11.0.169 | 109 | 11/29/2026 |
| 11.0.168 | 221 | 11/18/2026 |
| 11.0.167 | 99 | 11/18/2026 |
| 11.0.165 | 114 | 11/15/2026 |
| 11.0.163 | 170 | 11/11/2026 |
| 11.0.162 | 106 | 11/11/2026 |
| 11.0.161 | 105 | 11/11/2026 |
Updated Soenneker.Extensions.HttpContext to 11.0.792