1 implementation of HttpContext
Microsoft.AspNetCore.Http (1)
HttpContextAccessor.cs (1)
17public HttpContext? HttpContext
9 writes to HttpContext
Microsoft.AspNetCore.AsyncState.Tests (6)
AsyncContextHttpContextOfTTests.cs (6)
26_accessorMock.HttpContext = new DefaultHttpContext(); 59_accessorMock.HttpContext = null; 68_accessorMock.HttpContext = null; 77_accessorMock.HttpContext = null; 84_accessorMock.HttpContext = null; 97_accessorMock.HttpContext = null;
Microsoft.AspNetCore.Hosting (3)
Http\DefaultHttpContextFactory.cs (3)
63_httpContextAccessor.HttpContext = httpContext; 77_httpContextAccessor.HttpContext = null; 85_httpContextAccessor.HttpContext = null;
36 references to HttpContext
BasicWebSite (2)
Filters\RequestIdService.cs (1)
11if (contextAccessor.HttpContext.RequestServices != services)
StartupWithoutEndpointRouting.cs (1)
61var httpContext = contextAccessor.HttpContext;
ControllersFromServicesClassLibrary (1)
QueryValueService.cs (1)
14_context = httpContextAccessor.HttpContext;
Microsoft.AspNetCore.AsyncState (2)
AsyncContextHttpContext.cs (2)
36var httpContext = _httpContextAccessor.HttpContext; 49var httpContext = _httpContextAccessor.HttpContext;
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Logging\RequestHeadersLogEnricher.cs (2)
51if (_httpContextAccessor.HttpContext?.Request == null) 56var request = _httpContextAccessor.HttpContext.Request;
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (4)
Logging\RequestHeadersEnricherTests.cs (4)
52_accessorMock.SetupGet(r => r.HttpContext).Returns(httpContextMock.Object); 204accessorMock.SetupGet(r => r.HttpContext).Returns((HttpContext)null!); 237accessorMock.SetupGet(r => r.HttpContext).Returns(httpContextMock.Object); 261accessorMock.SetupGet(r => r.HttpContext).Returns(httpContextMock.Object);
Microsoft.AspNetCore.Hosting.Tests (3)
Http\DefaultHttpContextFactoryTests.cs (3)
26Assert.Same(context, accessor.HttpContext); 44Assert.Same(context, accessor.HttpContext); 48Assert.Null(accessor.HttpContext);
Microsoft.AspNetCore.Http.Abstractions (3)
IHttpContextAccessor.cs (3)
7/// Provides access to the current <see cref="HttpContext"/>, if one is available. 16/// Gets or sets the current <see cref="HttpContext"/>. Returns <see langword="null" /> if there is no active <see cref="HttpContext" />.
Microsoft.AspNetCore.Identity (3)
AspNetRoleManager.cs (1)
34_cancel = contextAccessor?.HttpContext?.RequestAborted ?? CancellationToken.None;
AspNetUserManager.cs (1)
42_cancel = services?.GetService<IHttpContextAccessor>()?.HttpContext?.RequestAborted ?? CancellationToken.None;
SignInManager.cs (1)
96var context = _context ?? _contextAccessor?.HttpContext;
Microsoft.AspNetCore.Identity.InMemory.Test (2)
ControllerTest.cs (2)
30contextAccessor.Setup(a => a.HttpContext).Returns(context); 82contextAccessor.Setup(a => a.HttpContext).Returns(context);
Microsoft.AspNetCore.Identity.Test (11)
SecurityStampValidatorTest.cs (6)
104contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object); 167contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object); 208contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object); 247contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object); 284contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object); 332contextAccessor.Setup(a => a.HttpContext).Returns(httpContext.Object);
SignInManagerTest.cs (5)
26contextAccessor.Setup(a => a.HttpContext).Returns(context.Object); 41contextAccessor.Setup(a => a.HttpContext).Returns(context.Object); 71contextAccessor.Setup(a => a.HttpContext).Returns(context.Object); 103contextAccessor.Setup(a => a.HttpContext).Returns(context); 1282contextAccessor.Setup(a => a.HttpContext).Returns(context);
Microsoft.AspNetCore.TestHost.Tests (2)
TestServerTests.cs (2)
580return context.Response.WriteAsync("HasContext:" + (accessor.HttpContext != null)); 611return context.Response.WriteAsync("HasContext:" + (accessor.Accessor.HttpContext != null));
ServerComparison.TestSites (1)
OneTransformPerRequest.cs (1)
23var context = ContextAccessor.HttpContext;