1 override of Items
Microsoft.AspNetCore.Http (1)
DefaultHttpContext.cs (1)
170public override IDictionary<object, object?> Items
391 references to Items
BasicWebSite (2)
Filters\TraceOutputResultFilter.cs (1)
13var trace = context.HttpContext.Items[nameof(TraceResourceFilter)];
Filters\TraceResourceFilter.cs (1)
16context.HttpContext.Items[nameof(TraceResourceFilter)] = $"This value was set by {nameof(TraceResourceFilter)}";
Microsoft.AspNetCore.Antiforgery (3)
AntiforgeryMiddleware.cs (1)
22context.Items[AntiforgeryMiddlewareWithEndpointInvokedKey] = AntiforgeryMiddlewareWithEndpointInvokedValue;
src\Shared\HttpExtensions.cs (2)
42if (endpoint == null && context.Items.TryGetValue(OriginalEndpointKey, out var e) && e is Endpoint originalEndpoint) 54context.Items[OriginalEndpointKey] = endpoint;
Microsoft.AspNetCore.Authentication.Test (10)
WsFederation\WsFederationTest.cs (5)
309context.HttpContext.Items["MessageReceived"] = true; 324context.HttpContext.Items["SecurityTokenReceived"] = true; 329Assert.True((bool)context.HttpContext.Items["MessageReceived"], "MessageReceived notification not invoked"); 330Assert.True((bool)context.HttpContext.Items["SecurityTokenReceived"], "SecurityTokenReceived notification not invoked"); 344context.HttpContext.Items["AuthenticationFailed"] = true;
WsFederation\WsFederationTest_Handler.cs (5)
305context.HttpContext.Items["MessageReceived"] = true; 320context.HttpContext.Items["SecurityTokenReceived"] = true; 325Assert.True((bool)context.HttpContext.Items["MessageReceived"], "MessageReceived notification not invoked"); 326Assert.True((bool)context.HttpContext.Items["SecurityTokenReceived"], "SecurityTokenReceived notification not invoked"); 340context.HttpContext.Items["AuthenticationFailed"] = true;
Microsoft.AspNetCore.Authorization.Policy (1)
AuthorizationMiddleware.cs (1)
102context.Items[AuthorizationMiddlewareInvokedWithEndpointKey] = AuthorizationMiddlewareWithEndpointInvokedValue;
Microsoft.AspNetCore.Components.Endpoints (5)
Rendering\EndpointHtmlRenderer.Prerendering.cs (2)
240if (!httpContext.Items.TryGetValue(ComponentSequenceKey, out var result)) 243httpContext.Items[ComponentSequenceKey] = result;
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (3)
171if (!httpContext.Items.TryGetValue(InvokedRenderModesKey, out var result)) 173httpContext.Items[InvokedRenderModesKey] = new InvokedRenderModes(currentInvocation); 196return httpContext.Items.TryGetValue(InvokedRenderModesKey, out var result)
Microsoft.AspNetCore.Components.Endpoints.Tests (5)
EndpointHtmlRendererTest.cs (5)
69Assert.Empty(httpContext.Items); 105var (_, mode) = Assert.Single(httpContext.Items); 324Assert.DoesNotContain(httpContext.Items.Values, value => value is InvokedRenderModes); 368var (_, mode) = Assert.Single(httpContext.Items, (kvp) => kvp.Value is InvokedRenderModes); 384var (_, mode) = Assert.Single(httpContext.Items, (kvp) => kvp.Value is InvokedRenderModes);
Microsoft.AspNetCore.Cors (1)
Infrastructure\CorsMiddleware.cs (1)
104context.Items[CorsMiddlewareWithEndpointInvokedKey] = CorsMiddlewareWithEndpointInvokedValue;
Microsoft.AspNetCore.Diagnostics (2)
src\Shared\HttpExtensions.cs (2)
42if (endpoint == null && context.Items.TryGetValue(OriginalEndpointKey, out var e) && e is Endpoint originalEndpoint) 54context.Items[OriginalEndpointKey] = endpoint;
Microsoft.AspNetCore.Diagnostics.Tests (12)
ExceptionHandlerMiddlewareTest.cs (12)
145Assert.True(httpContext.Items.ContainsKey("1")); 146Assert.True(httpContext.Items.ContainsKey("2")); 147Assert.True(httpContext.Items.ContainsKey("3")); 170Assert.True(httpContext.Items.ContainsKey("1")); 171Assert.True(httpContext.Items.ContainsKey("2")); 172Assert.False(httpContext.Items.ContainsKey("3")); 184context.Items["ExceptionHandler"] = true; 200Assert.True(httpContext.Items.ContainsKey("1")); 201Assert.True(httpContext.Items.ContainsKey("2")); 202Assert.True(httpContext.Items.ContainsKey("3")); 203Assert.True(httpContext.Items.ContainsKey("ExceptionHandler")); 476httpContext.Items[_name] = true;
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\JsonTranscodingServerCallContext.cs (2)
57HttpContext.Items["__HttpContext"] = HttpContext; 199protected override IDictionary<object, object> UserStateCore => HttpContext.Items!;
Microsoft.AspNetCore.Hosting (3)
Internal\HostingApplicationDiagnostics.cs (1)
151var reachedPipelineEnd = httpContext.Items.ContainsKey(RequestUnhandledKey);
src\Shared\HttpExtensions.cs (2)
42if (endpoint == null && context.Items.TryGetValue(OriginalEndpointKey, out var e) && e is Endpoint originalEndpoint) 54context.Items[OriginalEndpointKey] = endpoint;
Microsoft.AspNetCore.Http (2)
Builder\ApplicationBuilder.cs (1)
190context.Items[RequestUnhandledKey] = true;
Features\FormFeature.cs (1)
363var hasInvokedMiddleware = _request.HttpContext.Items.ContainsKey("__AntiforgeryMiddlewareWithEndpointInvoked");
Microsoft.AspNetCore.Http.Abstractions.Tests (21)
MapPathMiddlewareTests.cs (8)
15context.Items["test.PathBase"] = context.Request.PathBase.Value; 16context.Items["test.Path"] = context.Request.Path.Value; 65Assert.Equal(expectedPathBase, (string)context.Items["test.PathBase"]!); 66Assert.Equal(expectedPath, context.Items["test.Path"]); 93Assert.Equal(string.Concat(basePath, requestPath.AsSpan(0, matchPath.Length)), (string)context.Items["test.PathBase"]!); 94Assert.Equal(requestPath.Substring(matchPath.Length), context.Items["test.Path"]); 121Assert.Equal(basePath, (string)context.Items["test.PathBase"]!); 122Assert.Equal(requestPath, context.Items["test.Path"]);
UseMiddlewareTest.cs (2)
286context.Items["before"] = true; 288context.Items["after"] = true;
UsePathBaseExtensionsTests.cs (4)
215context.Items["test.Path"] = context.Request.Path; 216context.Items["test.PathBase"] = context.Request.PathBase; 222Assert.Equal(expectedPath, ((PathString?)requestContext.Items["test.Path"])!.Value.Value); 223Assert.Equal(expectedPathBase, ((PathString?)requestContext.Items["test.PathBase"])!.Value.Value);
UseWhenExtensionsTests.cs (7)
127if (!context.Items.ContainsKey(key)) 129context.Items[key] = 1; 133var item = context.Items[key]; 137context.Items[key] = 1 + (int)item; 141context.Items[key] = 1; 151if (!context.Items.ContainsKey(key)) 156var item = context.Items[key];
Microsoft.AspNetCore.Http.Connections (1)
Internal\HttpConnectionDispatcher.cs (1)
768newHttpContext.Items = new Dictionary<object, object?>(context.Items);
Microsoft.AspNetCore.Http.Extensions.Tests (190)
RequestDelegateFactoryTests.cs (44)
85httpContext.Items.Add("invoked", true); 127httpContext.Items.Add("invoked", true); 159httpContext.Items.Add("invoked", _invokedValue); 219httpContext.Items.Add("input", value); 224httpContext.Items.Add("input", value); 229httpContext.Items.Add("input", (object?)value ?? "Null"); 234httpContext.Items.Add("input", value); 246httpContext.Items["input"] = id; 302httpContext.Items["tryParsable"] = tryParsable; 354httpContext.Items["tryParsable"] = tryParsable; 611httpContext.Items["tryParsable"] = tryParsable; 645context.Items["headers"] = headerValues; 646context.Items["query"] = queryValues; 647context.Items["form"] = formValues; 673context.Items["headers"] = headerValues; 674context.Items["query"] = queryValues; 675context.Items["form"] = formValues; 697httpContext.Items["myAwaitedBindAsyncRecord"] = myAwaitedBindAsyncRecord; 698httpContext.Items["myAwaitedBindAsyncStruct"] = myAwaitedBindAsyncStruct; 787httpContext.Items.Add("body", todo); 792httpContext.Items.Add("body", todo); 797httpContext.Items.Add("body", todo); 802args.HttpContext.Items.Add("body", args.Todo); 821args.HttpContext.Items.Add("body", args.Todo); 1045httpContext.Items.Add("service", myService); 1050args.HttpContext.Items.Add("service", args.MyService); 1055httpContext.Items.Add("service", myServices.Single()); 1060httpContext.Items.Add("service", myService); 1079httpContext.Items.Add("service", myService); 1084args.HttpContext.Items.Add("service", args.MyService); 1089httpContext.Items.Add("service", myServices.Single()); 1094httpContext.Items.Add("service", myService); 1602context.Items["uri"] = myBindAsyncRecord.Uri; 1606context.Items["uri"] = myBindAsyncRecord?.Uri; 1610context.Items["uri"] = myBindAsyncRecord?.Uri; 1614context.Items["uri"] = mySimpleBindAsyncRecord.Uri; 1619context.Items["uri"] = myNullableBindAsyncStruct.Uri; 1623context.Items["uri"] = myNullableBindAsyncStruct?.Uri; 1627context.Items["uri"] = myNullableBindAsyncStruct?.Uri; 1631context.Items["uri"] = mySimpleBindAsyncStruct.Uri; 2122context.Items.Add("foo", args.Foo); 2206context.Items["invoked"] = true; 3090var @delegate = (string name, HttpContext context) => context.Items.Add("param", name); 3589httpContext.Items["calls"] = _calls;
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (5)
179Assert.NotEmpty(httpContext.Items); 180Assert.Equal(expectedParameterValue, httpContext.Items["tryParsable"]); 774Assert.Equal(new[] { 1, 2, 3 }, (int[])httpContext.Items["query"]!); 775Assert.Equal(new[] { 4, 5, 6 }, (int[])httpContext.Items["headers"]!); 776Assert.Equal(new[] { 7, 8, 9 }, (int[])httpContext.Items["form"]!);
RequestDelegateGenerator\RequestDelegateCreationTests.AsParameters.cs (12)
32Assert.Equal(originalRouteParam, httpContext.Items["input"]); 72Assert.Equal(originalQueryParam, httpContext.Items["input"]); 73Assert.Equal(originalCustomQueryParam, httpContext.Items["customInput"]); 74Assert.Equal(originalAnotherCustomQueryParam, httpContext.Items["anotherCustomInput"]); 100Assert.Equal(originalHeaderParam, httpContext.Items["input"]); 204Assert.Equal(originalRouteParam, httpContext.Items["input"]); 225Assert.Equal(expectedValue, httpContext.Items["input"]); 287var input = Assert.IsType<ParameterListWithReadOnlyProperties>(httpContext.Items["input"]); 318Assert.Equal(foo, httpContext.Items["foo"]); 319Assert.Equal(bar, httpContext.Items["bar"]); 344var value = Assert.IsType<InheritBindAsync>(httpContext.Items["value"]); 345var anotherValue = Assert.IsType<MyBindAsyncRecord>(httpContext.Items["anotherValue"]);
RequestDelegateGenerator\RequestDelegateCreationTests.BindAsync.cs (10)
60Assert.Equal(new Uri("https://example.org"), httpContext.Items["uri"]); 81Assert.Equal(new Uri("https://example.org"), httpContext.Items["uri"]); 110Assert.Null(httpContext.Items["uri"]); 139Assert.Null(httpContext.Items["uri"]); 248Assert.True(httpContext.Items["invoked"] as bool?); 249var arg = httpContext.Items["myBindAsyncParam"] as MyBindAsyncRecord; 252var todo = httpContext.Items["todo"] as Todo; 304Assert.True(httpContext.Items["invoked"] as bool?); 305var todo0 = httpContext.Items["customTodo"] as Todo; 308var todo1 = httpContext.Items["todo"] as Todo;
RequestDelegateGenerator\RequestDelegateCreationTests.cs (9)
439Assert.Equal(42, httpContext.Items["id"]); 465Assert.Equal(42, httpContext.Items["id"]); 487Assert.Null(httpContext.Items["id"]); 512Assert.Equal(42, httpContext.Items["id"]); 537Assert.Equal(42, httpContext.Items["id"]); 562Assert.Equal(42, httpContext.Items["id"]); 598Assert.Equal(new[] { 1, 2, 3 }, (int[])httpContext.Items["query"]!); 599Assert.Equal(new[] { 4, 5, 6 }, (int[])httpContext.Items["headers"]!); 600Assert.Equal(new[] { 7, 8, 9 }, (int[])httpContext.Items["form"]!);
RequestDelegateGenerator\RequestDelegateCreationTests.Filters.cs (5)
37Assert.Null(httpContext.Items["invoked"]); 38Assert.True(httpContext.Items["filterInvoked"] as bool?); 71Assert.True(httpContext.Items["invoked"] as bool?); 72Assert.True(httpContext.Items["filterInvoked"] as bool?); 152Assert.Equal(2, httpContext.Items["loggerInvoked"]);
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (58)
41Assert.Equal(httpContext.Request.Form.Files, httpContext.Items["formFiles"]); 42var formFilesArgument = Assert.IsAssignableFrom<IFormFileCollection>(httpContext.Items["formFiles"]); 76Assert.Equal(httpContext.Request.Form.Files, httpContext.Items["formFiles"]); 77var formFiles = Assert.IsAssignableFrom<IFormFileCollection>(httpContext.Items["formFiles"]); 111Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["formFiles"]); 112var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["formFiles"]); 149Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["formFiles"]); 150var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["formFiles"]); 187Assert.Equal(httpContext.Request.Form.Files["file1"], httpContext.Items["file1"]); 188var file1Argument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["file1"]); 192Assert.Equal(httpContext.Request.Form.Files["file2"], httpContext.Items["file2"]); 193var file2Argument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["file2"]); 228Assert.Equal(httpContext.Request.Form.Files["file1"], httpContext.Items["file1"]); 229Assert.NotNull(httpContext.Items["file1"]); 231Assert.Equal(httpContext.Request.Form.Files["file2"], httpContext.Items["file2"]); 232Assert.Null(httpContext.Items["file2"]); 265Assert.Equal(httpContext.Request.Form.Files["my_file"], httpContext.Items["formFiles"]); 266var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["formFiles"]); 302Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["formFiles"]); 303var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["formFiles"]); 307var traceIdArgument = Assert.IsType<TraceIdentifier>(httpContext.Items["traceId"]); 368httpContext.Items["invoked"] = false; 375Assert.False((bool)httpContext.Items["invoked"]); 408Assert.Equal(httpContext.Request.Form.Files, httpContext.Items["formFiles"]); 409var formFilesArgument = Assert.IsType<FormFileCollection>(httpContext.Items["formFiles"]); 412Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["file"]); 413var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["file"]); 459Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["file"]); 460var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["file"]); 464var traceIdArgument = Assert.IsAssignableFrom<TraceIdentifier>(httpContext.Items["traceId"]); 504Assert.Equal(httpContext.Request.Form.Files["file"], httpContext.Items["file"]); 505var fileArgument = Assert.IsAssignableFrom<IFormFile>(httpContext.Items["file"]); 509var traceIdArgument = Assert.IsAssignableFrom<TraceIdentifier>(httpContext.Items["traceId"]); 556Assert.Equal(httpContext.Request.Form, httpContext.Items["formFiles"]); 557var formArgument = Assert.IsAssignableFrom<IFormCollection>(httpContext.Items["formFiles"]); 603Assert.Equal(httpContext.Request.Form, httpContext.Items["formFiles"]); 604var formArgument = Assert.IsAssignableFrom<IFormCollection>(httpContext.Items["formFiles"]); 650Assert.Equal(httpContext.Request.Form["message"][0], httpContext.Items["message"]); 679Assert.Equal(httpContext.Request.Form["message"][0], httpContext.Items["message"]); 680Assert.NotNull(httpContext.Items["message"]); 682Assert.Equal(httpContext.Request.Form["name"][0], httpContext.Items["name"]); 683Assert.NotNull(httpContext.Items["name"]); 712Assert.Equal(httpContext.Request.Form["message"][0], httpContext.Items["message"]); 713Assert.NotNull(httpContext.Items["message"]); 714Assert.Null(httpContext.Items["additionalMessage"]); 742Assert.Equal(httpContext.Request.Form["message"][0], httpContext.Items["message"]); 743Assert.NotNull(httpContext.Items["message"]); 772Assert.Equal(httpContext.Request.Form["message"][0], httpContext.Items["message"]); 773Assert.NotNull(httpContext.Items["message"]); 775var traceIdArgument = Assert.IsType<TraceIdentifier>(httpContext.Items["traceId"]); 835var formFilesArgument = Assert.IsAssignableFrom<FormFileCollection>(httpContext.Items["FormFilesArgument"]); 836var formArgument = Assert.IsAssignableFrom<IFormCollection>(httpContext.Items["FormArgument"]); 872httpContext.Items["invoked"] = false; 879Assert.False((bool)httpContext.Items["invoked"]); 904var content = Assert.IsType<MyTryParseRecord>(httpContext.Items["tryParsable"]); 937Assert.Null(httpContext.Items["invoked"]); 969Assert.Null(httpContext.Items["invoked"]); 1006Assert.Null(httpContext.Items["invoked"]);
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBody.cs (7)
254var rawRequestBody = httpContext.Items["body"]; 295var rawRequestBody = httpContext.Items["body"]; 336var rawRequestBody = httpContext.Items["body"]; 377var rawRequestBody = httpContext.Items["body"]; 400httpContext.Items[structToBeZeroedKey] = new BodyStruct { Id = 42 }; 404Assert.Equal(default(BodyStruct), httpContext.Items[structToBeZeroedKey]); 436var resultStruct = Assert.IsType<BodyStruct>(httpContext.Items["targetStruct"]);
RequestDelegateGenerator\RequestDelegateCreationTests.KeyServices.cs (11)
28Assert.Same(myOriginalService, httpContext.Items["arg"]); 76Assert.Same(myOriginalService1, httpContext1.Items["arg"]); 77Assert.Same(myOriginalService2, httpContext2.Items["arg"]); 94Assert.Same(myOriginalService, httpContext.Items["arg"]); 114Assert.Same(myOriginalService, httpContext.Items["arg"]); 146Assert.Null(httpContext.Items["arg"]); 171Assert.Same(myOriginalService1, httpContext.Items["arg1"]); 172Assert.IsType<TestService>(httpContext.Items["arg2"]); 200Assert.Same(myOriginalService1, httpContext.Items["arg1"]); 201Assert.IsType<TestService>(httpContext.Items["arg2"]); 202Assert.Same(myOriginalService2, httpContext.Items["arg3"]);
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (12)
40Assert.Null(httpContext.Items["invoked"]); 103Assert.Null(httpContext.Items["invoked"]); 154Assert.Null(httpContext.Items["invoked"]); 224Assert.Null(httpContext.Items["invoked"]); 271Assert.Null(httpContext.Items["invoked"]); 304Assert.Null(httpContext.Items["invoked"]); 350Assert.Null(httpContext.Items["invoked"]); 488Assert.Null(httpContext.Items["invoked"]); 524Assert.Null(httpContext.Items["invoked"]); 565Assert.Null(httpContext.Items["invoked"]); 604Assert.Null(httpContext.Items["invoked"]); 644Assert.Null(httpContext.Items["invoked"]);
RequestDelegateGenerator\RequestDelegateCreationTests.RouteParameter.cs (1)
232Assert.Equal(originalRouteParam, httpContext.Items["input"]);
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (13)
40Assert.Same(httpContext, httpContext.Items["arg"]); 63Assert.Equal(httpContext.RequestAborted, httpContext.Items["arg"]); 84Assert.Same(user, httpContext.Items["arg"]); 103Assert.Equal(httpContext.Request, httpContext.Items["arg"]); 122Assert.Equal(httpContext.Response, httpContext.Items["arg"]); 147Assert.Same(httpContext, httpContext.Items["input"]); 148Assert.Same(httpContext.User, httpContext.Items["user"]); 149Assert.Same(httpContext.Request, httpContext.Items["request"]); 150Assert.Same(httpContext.Response, httpContext.Items["response"]); 251Assert.Equal(expectedValue, httpContext.Items["parameterWithDefault"]); 254Assert.Equal(expectedValue, httpContext.Items["parameterWithConst"]); 283Assert.Equal(2.15m, httpContext.Items["parameterWithDefault"]); 284Assert.Equal(3.15m, httpContext.Items["parameterWithConst"]);
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (3)
83Assert.Equal(expectedParameterValue, httpContext.Items["tryParsable"]); 215var p = httpContext.Items["p"]; 262Assert.Equal(expectedParameterValue, httpContext.Items["tryParsable"]);
Microsoft.AspNetCore.Http.Results.Tests (46)
ResultsOfTTests.Generated.cs (46)
59Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 122Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 147Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 174Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 201Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 274Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 339Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 366Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 393Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 422Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 451Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 480Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 558Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 625Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 654Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 683Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 712Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 743Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 774Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 805Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 836Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 919Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 988Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1019Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1050Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1081Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1112Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1145Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1178Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1211Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1244Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1277Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1365Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1436Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1469Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1502Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1535Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1568Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1601Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1636Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1671Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1706Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1741Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1776Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1811Assert.Equal(input, httpContext.Items[nameof(ChecksumResult.Checksum)]); 1852httpContext.Items[nameof(ChecksumResult.Checksum)] = Checksum;
Microsoft.AspNetCore.Http.Tests (3)
Timeouts\RequestTimeoutsMiddlewareTests.cs (3)
293context.Items["SetFrom"] = "default"; 304context.Items["SetFrom"] = "policy1"; 314context.Items["SetFrom"] = "policy2";
Microsoft.AspNetCore.Mvc.Core (4)
Routing\UrlHelperFactory.cs (4)
30if (httpContext.Items == null) 33nameof(HttpContext.Items), 38if (httpContext.Items.TryGetValue(typeof(IUrlHelper), out var value) && value is IUrlHelper urlHelper) 60httpContext.Items[typeof(IUrlHelper)] = urlHelper;
Microsoft.AspNetCore.Mvc.Core.Test (12)
Authorization\AuthorizeFilterTest.cs (1)
622httpContext.SetupGet(c => c.Items).Returns(contextItems);
Filters\FilterFactoryTest.cs (3)
213var filter = new TestFilter(providerContext.ActionContext.HttpContext.Items["name"] as string); 231actionContext.HttpContext.Items["name"] = "foo"; 243actionContext.HttpContext.Items["name"] = "bar";
Infrastructure\ControllerActionInvokerTest.cs (3)
1404context.SetupGet(c => c.Items) 1445Assert.Equal(5, context.Object.Items["Result"]); 1961context.HttpContext.Items["Result"] = Value;
Routing\UrlHelperTestBase.cs (5)
893httpContext.Setup(h => h.Items).Returns(mockItems); 911httpContext.Setup(h => h.Items).Returns(new Dictionary<object, object>()); 921Assert.Same(urlHelper, actionContext.HttpContext.Items[typeof(IUrlHelper)] as IUrlHelper); 934httpContext.Setup(h => h.Items).Returns(mockItems); 944Assert.Same(urlHelper, actionContext.HttpContext.Items[typeof(IUrlHelper)] as IUrlHelper);
Microsoft.AspNetCore.Mvc.ViewFeatures (8)
Filters\AntiforgeryMiddlewareAuthorizationFilter.cs (1)
19if (context.HttpContext.Items.ContainsKey(AntiforgeryMiddlewareWithEndpointInvokedKey))
Filters\SaveTempDataFilter.cs (3)
32if (!context.HttpContext.Items.ContainsKey(SaveTempDataFilterContextKey)) 39context.HttpContext.Items.Add(SaveTempDataFilterContextKey, tempDataContext); 120if (httpContext.Items.TryGetValue(SaveTempDataFilterContextKey, out var value))
NameAndIdProvider.cs (2)
43var items = viewContext.HttpContext.Items; 142var items = viewContext.HttpContext.Items;
TempDataDictionaryFactory.cs (2)
35if (context.Items.TryGetValue(Key, out obj)) 42context.Items.Add(Key, result);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Filters\SaveTempDataFilterTest.cs (2)
102httpContext.Items[SaveTempDataFilter.SaveTempDataFilterContextKey] = new SaveTempDataFilter.SaveTempDataContext() { TempDataSaved = true }; 124httpContext.Items[SaveTempDataFilter.SaveTempDataFilterContextKey] = new SaveTempDataFilter.SaveTempDataContext() { RequestHasUnhandledException = true };
Microsoft.AspNetCore.Owin (17)
OwinEnvironment.cs (17)
108else if (!_context.Items.ContainsKey(OwinConstants.CallCancelled)) 110_context.Items[OwinConstants.CallCancelled] = CancellationToken.None; 114if (!context.Items.ContainsKey(OwinConstants.OwinVersion)) 116_context.Items[OwinConstants.OwinVersion] = "1.0"; 132_context.Items[typeof(HttpContext).FullName] = _context; // Store for lookup when we transition back out of OWIN 150_context.Items.Add(key, value); 163.Select(pair => pair.Key).Concat(_context.Items.Keys.Select(key => Convert.ToString(key, CultureInfo.InvariantCulture))).ToList(); 173return _context.Items.Remove(key); 183return _context.Items.TryGetValue(key, out value); 201if (_context.Items.TryGetValue(key, out value)) 221_context.Items[key] = value; 229_context.Items.Remove(key); 233_context.Items[key] = value; 247_context.Items.Clear(); 259if (arrayIndex + _entries.Count + _context.Items.Count > array.Length) 273get { return _entries.Count + _context.Items.Count; } 297foreach (var entryPair in _context.Items)
Microsoft.AspNetCore.Routing (5)
EndpointMiddleware.cs (3)
42!httpContext.Items.ContainsKey(AuthorizationMiddlewareInvokedKey)) 48!httpContext.Items.ContainsKey(CorsMiddlewareInvokedKey)) 54!httpContext.Items.ContainsKey(AntiforgeryMiddlewareWithEndpointInvokedKey))
src\Shared\HttpExtensions.cs (2)
42if (endpoint == null && context.Items.TryGetValue(OriginalEndpointKey, out var e) && e is Endpoint originalEndpoint) 54context.Items[OriginalEndpointKey] = endpoint;
Microsoft.AspNetCore.Routing.Tests (27)
Builder\GroupTest.cs (5)
30httpContext.Items["id"] = id; 61httpContext.Items["org"] = org; 62httpContext.Items["id"] = id; 95httpContext.Items["org"] = org; 96httpContext.Items["id"] = id;
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (9)
186context.Items["ExecutedEndpoint"] = true; 196httpContext.Items["First"] = true; 206httpContext.Items["Second"] = true; 233var @delegate = (HttpContext context) => context.Items.Add("param", "Value"); 305if (httpContext.Items["CurrentOrder"] is int) 307order = (int)httpContext.Items["CurrentOrder"]!; 309httpContext.Items["CurrentOrder"] = order; 314httpContext.Items["CurrentOrder"] = order; 316httpContext.Items[$"{_name}-Order"] = order;
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (12)
140httpContext.Items["input"] = id; 178httpContext.Items["input"] = id; 513httpContext.Items["input"] = id; 555httpContext.Items["input"] = id; 606httpContext.Items["value"] = id; 629httpContext.Items["value"] = id; 963string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}"; 996string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}"; 1084context.HttpContext.Items["loggerErrorIsEnabled"] = _logger.IsEnabled(LogLevel.Error); 1085context.HttpContext.Items["parentName"] = _routeHandlerContext.MethodInfo.DeclaringType?.Name;
TestConstants.cs (1)
13context.Items["ShortCircuit"] = true;
Mvc.RoutingWebSite (5)
Controllers\ItemsController.cs (2)
13return Ok(HttpContext.Items); 24return Ok(HttpContext.Items);
StartupForEndpointFilters.cs (3)
32ic.HttpContext.Items[nameof(IEndpointFilter)] = true; 33ic.HttpContext.Items[nameof(EndpointFilterFactoryContext.MethodInfo.Name)] = context.MethodInfo.Name; 48ic.HttpContext.Items[nameof(EndpointFilterInvocationContext.Arguments)] = firstArg;
ServerComparison.TestSites (2)
OneTransformPerRequest.cs (2)
24if (context.Items["Transformed"] != null) 28context.Items["Transformed"] = true;