154 writes to HttpContext
Microsoft.AspNetCore.Mvc.Abstractions (1)
ActionContext.cs (1)
72
HttpContext
= httpContext;
Microsoft.AspNetCore.Mvc.Core.Test (86)
ControllerBaseTest.cs (8)
1864
controller.ControllerContext.
HttpContext
= mockHttpContext.Object;
1891
controller.ControllerContext.
HttpContext
= mockHttpContext.Object;
1917
controller.ControllerContext.
HttpContext
= mockHttpContext.Object;
1943
controller.ControllerContext.
HttpContext
= mockHttpContext.Object;
2998
controller.ControllerContext.
HttpContext
= httpContext.Object;
3018
controller.ControllerContext.
HttpContext
= httpContext.Object;
3038
controller.ControllerContext.
HttpContext
= httpContext.Object;
3216
HttpContext
= httpContext,
Controllers\ControllerActivatorProviderTest.cs (1)
54
HttpContext
= new DefaultHttpContext
Controllers\ControllerBinderDelegateProviderTest.cs (1)
1257
HttpContext
= new DefaultHttpContext()
Controllers\DefaultControllerFactoryTest.cs (6)
28
HttpContext
= new DefaultHttpContext()
62
HttpContext
= new DefaultHttpContext()
89
HttpContext
= new DefaultHttpContext()
116
HttpContext
= new DefaultHttpContext()
143
HttpContext
= new DefaultHttpContext()
171
HttpContext
= new DefaultHttpContext()
DependencyInjection\ApiBehaviorOptionsSetupTest.cs (1)
148
HttpContext
= new DefaultHttpContext { TraceIdentifier = "42" },
FileResultHelperTest.cs (4)
265
actionContext.
HttpContext
= httpContext;
304
actionContext.
HttpContext
= httpContext;
341
actionContext.
HttpContext
= httpContext;
369
actionContext.
HttpContext
= httpContext;
HttpNotFoundObjectResultTest.cs (1)
43
HttpContext
= httpContext,
Infrastructure\ControllerActionInvokerProviderTest.cs (1)
30
HttpContext
= new DefaultHttpContext(),
Infrastructure\FileStreamResultExecutorTest.cs (1)
18
var actionContext = new ActionContext() {
HttpContext
= httpContext };
Infrastructure\ObjectResultExecutorTest.cs (17)
25
var actionContext = new ActionContext() {
HttpContext
= httpContext };
53
var actionContext = new ActionContext() {
HttpContext
= httpContext };
76
var actionContext = new ActionContext() {
HttpContext
= httpContext };
98
var actionContext = new ActionContext() {
HttpContext
= httpContext };
119
var actionContext = new ActionContext() {
HttpContext
= httpContext };
144
var actionContext = new ActionContext() {
HttpContext
= httpContext };
166
var actionContext = new ActionContext() {
HttpContext
= httpContext };
188
var actionContext = new ActionContext() {
HttpContext
= httpContext };
214
var actionContext = new ActionContext() {
HttpContext
= httpContext };
239
var actionContext = new ActionContext() {
HttpContext
= httpContext };
261
HttpContext
= GetHttpContext(),
290
HttpContext
= GetHttpContext(),
313
HttpContext
= GetHttpContext(),
347
var actionContext = new ActionContext() {
HttpContext
= new DefaultHttpContext() };
387
HttpContext
= GetHttpContext(),
424
HttpContext
= GetHttpContext(),
447
HttpContext
= GetHttpContext(),
Infrastructure\ProblemDetalsClientErrorFactoryTest.cs (1)
124
HttpContext
= new DefaultHttpContext
ModelBinding\Binders\ArrayModelBinderTest.cs (1)
233
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\BinderTypeModelBinderTest.cs (1)
77
HttpContext
= new DefaultHttpContext() { RequestServices = new ServiceCollection().BuildServiceProvider() },
ModelBinding\Binders\BodyModelBinderTests.cs (1)
693
HttpContext
= httpContext,
ModelBinding\Binders\CancellationTokenModelBinderTests.cs (1)
33
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\CollectionModelBinderTest.cs (1)
533
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\ComplexObjectModelBinderTest.cs (5)
468
HttpContext
= new DefaultHttpContext()
495
HttpContext
= new DefaultHttpContext()
523
HttpContext
= new DefaultHttpContext(),
550
HttpContext
= new DefaultHttpContext()
576
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\ComplexTypeModelBinderTest.cs (5)
649
HttpContext
= new DefaultHttpContext()
676
HttpContext
= new DefaultHttpContext()
704
HttpContext
= new DefaultHttpContext(),
731
HttpContext
= new DefaultHttpContext()
757
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\DictionaryModelBinderTest.cs (1)
624
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\FormCollectionModelBinderTest.cs (1)
73
HttpContext
= httpContext,
ModelBinding\Binders\FormFileModelBinderTest.cs (6)
52
new ActionContext {
HttpContext
= httpContext },
90
new ActionContext {
HttpContext
= httpContext },
132
new ActionContext {
HttpContext
= httpContext },
167
new ActionContext {
HttpContext
= httpContext },
203
new ActionContext {
HttpContext
= httpContext },
461
HttpContext
= httpContext,
ModelBinding\Binders\HeaderModelBinderTests.cs (1)
364
HttpContext
= new DefaultHttpContext()
ModelBinding\Binders\KeyValuePairModelBinderTest.cs (1)
205
HttpContext
= new DefaultHttpContext(),
ModelBinding\Binders\ServicesModelBinderTest.cs (1)
46
HttpContext
= new DefaultHttpContext()
ModelBinding\DefaultModelBindingContextTest.cs (1)
162
HttpContext
= new DefaultHttpContext()
ModelBinding\ModelBindingHelperTest.cs (1)
1500
HttpContext
= new DefaultHttpContext()
ModelBinding\ParameterBinderTest.cs (1)
711
HttpContext
= new DefaultHttpContext()
ModelBinding\UnsupportedContentTypeFilterTest.cs (4)
20
HttpContext
= new DefaultHttpContext(),
53
HttpContext
= new DefaultHttpContext(),
79
HttpContext
= new DefaultHttpContext(),
103
HttpContext
= new DefaultHttpContext(),
ModelBinding\Validation\DefaultObjectValidatorTests.cs (1)
587
var actionContext = new ActionContext {
HttpContext
= httpContext.Object };
ObjectResultTests.cs (4)
49
HttpContext
= new DefaultHttpContext()
81
HttpContext
= new DefaultHttpContext()
110
HttpContext
= new DefaultHttpContext()
141
HttpContext
= new DefaultHttpContext()
RedirectToPageResultTest.cs (2)
86
HttpContext
= httpContext,
143
HttpContext
= httpContext,
Routing\UrlHelperExtensionsTest.cs (3)
717
HttpContext
= new DefaultHttpContext
765
HttpContext
= new DefaultHttpContext
813
HttpContext
= new DefaultHttpContext
Routing\UrlHelperTestBase.cs (1)
1084
HttpContext
= new DefaultHttpContext()
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
DataAnnotationsModelValidatorTest.cs (1)
425
HttpContext
= httpContext.Object
Microsoft.AspNetCore.Mvc.IntegrationTests (2)
BindPropertyIntegrationTest.cs (1)
230
HttpContext
= testContext.HttpContext,
ModelBindingTestHelper.cs (1)
36
HttpContext
= httpContext,
Microsoft.AspNetCore.Mvc.Razor.Test (4)
TagHelpers\UrlResolutionTagHelperTest.cs (4)
115
ViewContext = new Rendering.ViewContext {
HttpContext
= new DefaultHttpContext() }
175
ViewContext = new Rendering.ViewContext {
HttpContext
= new DefaultHttpContext() }
369
ViewContext = new Rendering.ViewContext {
HttpContext
= new DefaultHttpContext() }
415
ViewContext = new Rendering.ViewContext {
HttpContext
= httpContext }
Microsoft.AspNetCore.Mvc.RazorPages.Test (48)
ApplicationModels\DefaultPageApplicationModelProviderTest.cs (1)
990
HttpContext
= new DefaultHttpContext
Filters\PageSaveTempDataPropertyFilterTest.cs (3)
62
HttpContext
= httpContext,
103
HttpContext
= httpContext,
143
HttpContext
= httpContext,
Infrastructure\DefaultPageFactoryProviderTest.cs (7)
229
HttpContext
= pageContext.HttpContext,
260
HttpContext
= new DefaultHttpContext
268
HttpContext
= pageContext.HttpContext,
303
HttpContext
= new DefaultHttpContext
311
HttpContext
= pageContext.HttpContext,
341
HttpContext
= new DefaultHttpContext
349
HttpContext
= pageContext.HttpContext,
Infrastructure\DefaultPageHandlerMethodSelectorTest.cs (15)
37
HttpContext
= new DefaultHttpContext
85
HttpContext
= new DefaultHttpContext
136
HttpContext
= new DefaultHttpContext
180
HttpContext
= new DefaultHttpContext
216
HttpContext
= new DefaultHttpContext
259
HttpContext
= new DefaultHttpContext
309
HttpContext
= new DefaultHttpContext
359
HttpContext
= new DefaultHttpContext
410
HttpContext
= new DefaultHttpContext
454
HttpContext
= new DefaultHttpContext
505
HttpContext
= new DefaultHttpContext
550
HttpContext
= new DefaultHttpContext
600
HttpContext
= new DefaultHttpContext
650
HttpContext
= new DefaultHttpContext
710
HttpContext
= new DefaultHttpContext
Infrastructure\DefaultPageModelActivatorProviderTest.cs (2)
48
HttpContext
= httpContext
78
HttpContext
= httpContext
Infrastructure\PageActionInvokerProviderTest.cs (9)
56
HttpContext
= new DefaultHttpContext(),
118
HttpContext
= new DefaultHttpContext(),
184
HttpContext
= new DefaultHttpContext(),
216
HttpContext
= new DefaultHttpContext(),
232
HttpContext
= new DefaultHttpContext(),
262
HttpContext
= new DefaultHttpContext(),
296
HttpContext
= new DefaultHttpContext(),
333
HttpContext
= new DefaultHttpContext(),
350
HttpContext
= new DefaultHttpContext(),
Infrastructure\PageActionInvokerTest.cs (1)
1507
HttpContext
= httpContext,
Infrastructure\PageBinderFactoryTest.cs (1)
800
HttpContext
= httpContext
Infrastructure\ServiceBasedPageModelActivatorProviderTest.cs (3)
40
HttpContext
= new DefaultHttpContext
72
HttpContext
= new DefaultHttpContext
106
HttpContext
= httpContext,
PageModelTest.cs (4)
1450
HttpContext
= mockHttpContext.Object
1476
HttpContext
= mockHttpContext.Object
1794
HttpContext
= httpContext,
1798
HttpContext
= httpContext,
PageTest.cs (2)
1440
HttpContext
= mockHttpContext.Object
1466
HttpContext
= mockHttpContext.Object
Microsoft.AspNetCore.Mvc.TagHelpers.Test (4)
ComponentTagHelperTest.cs (1)
97
return new ViewContext {
HttpContext
= httpContext };
DefaultTagHelperActivatorTest.cs (1)
68
HttpContext
= new DefaultHttpContext
ImageTagHelperTest.cs (1)
196
helper.ViewContext.
HttpContext
= new DefaultHttpContext();
PersistComponentStateTagHelperTest.cs (1)
268
return new ViewContext {
HttpContext
= httpContext };
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (8)
ControllerTest.cs (1)
447
HttpContext
= httpContext,
ControllerUnitTestabilityTests.cs (2)
162
controller.ControllerContext.
HttpContext
= mockHttpContext.Object;
601
HttpContext
= httpContext,
Filters\ControllerSaveTempDataPropertyFilterTest.cs (4)
41
HttpContext
= httpContext,
87
HttpContext
= httpContext,
130
HttpContext
= httpContext,
169
HttpContext
= httpContext,
ViewComponents\DefaultViewComponentActivatorTests.cs (1)
91
HttpContext
= new DefaultHttpContext
613 references to HttpContext
BasicWebSite (10)
Controllers\TestingController.cs (2)
108
context.
HttpContext
.Response.Redirect(_url);
109
context.
HttpContext
.Response.StatusCode = (int)_statusCode;
Filters\ServiceActionFilter.cs (1)
24
context.
HttpContext
.Response.Headers["X-ServiceActionFilter"] = "True";
Filters\TestExceptionFilter.cs (1)
13
if (context.
HttpContext
.Request.Query.TryGetValue("handleException", out var handleException))
Filters\TraceOutputResultFilter.cs (1)
13
var trace = context.
HttpContext
.Items[nameof(TraceResourceFilter)];
Filters\TraceResourceFilter.cs (1)
16
context.
HttpContext
.Items[nameof(TraceResourceFilter)] = $"This value was set by {nameof(TraceResourceFilter)}";
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (3)
27
var query = _actionContext.
HttpContext
.Request.Query;
43
actualUrl = _actionContext.
HttpContext
.Request.Path.Value,
56
var services = context.
HttpContext
.RequestServices;
StoreIntoTempDataActionResult.cs (1)
14
var httpContext = context.
HttpContext
;
ControllersFromServicesClassLibrary (1)
ControllerWithConstructorInjection.cs (1)
33
ActionContext.
HttpContext
.Request.Headers["Test-Header"]);
GenericHostWebSite (5)
Controllers\TestingController.cs (2)
94
context.
HttpContext
.Response.Redirect(_url);
95
context.
HttpContext
.Response.StatusCode = (int)_statusCode;
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (3)
27
var query = _actionContext.
HttpContext
.Request.Query;
43
actualUrl = _actionContext.
HttpContext
.Request.Path.Value,
56
var services = context.
HttpContext
.RequestServices;
Microsoft.AspNetCore.Identity.UI (1)
Areas\Identity\Filters\ExternalLoginsPageFilter.cs (1)
18
var signInManager = context.
HttpContext
.RequestServices.GetRequiredService<SignInManager<TUser>>();
Microsoft.AspNetCore.Mvc.Abstractions (2)
ActionContext.cs (1)
33
actionContext.
HttpContext
,
ModelBinding\ModelBindingContext.cs (1)
41
public virtual HttpContext HttpContext => ActionContext?.
HttpContext
!;
Microsoft.AspNetCore.Mvc.Core (119)
AcceptedAtActionResult.cs (3)
69
var request = context.
HttpContext
.Request;
74
var services = context.
HttpContext
.RequestServices;
90
context.
HttpContext
.Response.Headers.Location = url;
AcceptedAtRouteResult.cs (2)
75
var services = context.
HttpContext
.RequestServices;
86
context.
HttpContext
.Response.Headers.Location = url;
AcceptedResult.cs (1)
77
context.
HttpContext
.Response.Headers.Location = Location;
ApplicationModels\DefaultApplicationModelProvider.cs (1)
35
_supportsNonGetRequests = context => !HttpMethods.IsGet(context.
HttpContext
.Request.Method);
Authorization\AuthorizeFilter.cs (6)
137
var endpoint = context.
HttpContext
.GetEndpoint();
145
var policyProvider = PolicyProvider ?? context.
HttpContext
.RequestServices.GetRequiredService<IAuthorizationPolicyProvider>();
175
var policyEvaluator = context.
HttpContext
.RequestServices.GetRequiredService<IPolicyEvaluator>();
177
var authenticateResult = await policyEvaluator.AuthenticateAsync(effectivePolicy, context.
HttpContext
);
185
var authorizeResult = await policyEvaluator.AuthorizeAsync(effectivePolicy, authenticateResult, context.
HttpContext
, context);
224
var endpoint = context.
HttpContext
.GetEndpoint();
BindPropertyAttribute.cs (1)
86
return !HttpMethods.IsGet(context.
HttpContext
.Request.Method);
ChallengeResult.cs (1)
95
var httpContext = context.
HttpContext
;
ConsumesAttribute.cs (1)
114
var requestContentType = context.
HttpContext
.Request.ContentType;
ContentResult.cs (1)
35
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<ContentResult>>();
ControllerBase.cs (1)
37
public HttpContext HttpContext => ControllerContext.
HttpContext
;
Controllers\ControllerActivatorProvider.cs (1)
59
return controllerContext => typeActivator(controllerContext.
HttpContext
.RequestServices, arguments: null);
Controllers\DefaultControllerActivator.cs (1)
48
var serviceProvider = controllerContext.
HttpContext
.RequestServices;
Controllers\ServiceBasedControllerActivator.cs (1)
21
return actionContext.
HttpContext
.RequestServices.GetRequiredService(controllerType);
CreatedAtActionResult.cs (3)
69
var request = context.
HttpContext
.Request;
74
var services = context.
HttpContext
.RequestServices;
90
context.
HttpContext
.Response.Headers.Location = url;
CreatedAtRouteResult.cs (2)
75
var services = context.
HttpContext
.RequestServices;
86
context.
HttpContext
.Response.Headers.Location = url;
CreatedResult.cs (1)
85
context.
HttpContext
.Response.Headers.Location = Location;
DependencyInjection\ApiBehaviorOptionsSetup.cs (2)
23
_problemDetailsFactory ??= context.
HttpContext
.RequestServices.GetRequiredService<ProblemDetailsFactory>();
32
var problemDetails = problemDetailsFactory.CreateValidationProblemDetails(context.
HttpContext
, context.ModelState);
FileContentResult.cs (1)
66
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<FileContentResult>>();
FileStreamResult.cs (1)
67
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<FileStreamResult>>();
Filters\DefaultFilterProvider.cs (1)
51
var services = context.ActionContext.
HttpContext
.RequestServices;
Filters\DisableRequestSizeLimitFilter.cs (1)
43
var maxRequestBodySizeFeature = context.
HttpContext
.Features.Get<IHttpMaxRequestBodySizeFeature>();
Filters\MiddlewareFilter.cs (1)
24
var httpContext = context.
HttpContext
;
Filters\OutputCacheFilter.cs (1)
39
var outputCachingFeature = context.
HttpContext
.Features.Get<IOutputCacheFeature>();
Filters\RequestFormLimitsFilter.cs (2)
34
var features = context.
HttpContext
.Features;
40
features.Set<IFormFeature>(new FormFeature(context.
HttpContext
.Request, FormOptions));
Filters\RequestSizeLimitFilter.cs (1)
45
var maxRequestBodySizeFeature = context.
HttpContext
.Features.Get<IHttpMaxRequestBodySizeFeature>();
Filters\ResponseCacheFilterExecutor.cs (2)
69
var headers = context.
HttpContext
.Response.Headers;
83
var responseCachingFeature = context.
HttpContext
.Features.Get<IResponseCachingFeature>();
ForbidResult.cs (1)
95
var httpContext = context.
HttpContext
;
Formatters\FormatFilter.cs (2)
46
var query = context.
HttpContext
.Request.Query["format"];
151
!string.IsNullOrEmpty(context.
HttpContext
.Response.ContentType))
HttpActionResult.cs (1)
30
=> Result.ExecuteAsync(context.
HttpContext
);
Infrastructure\ContentResultExecutor.cs (1)
39
var response = context.
HttpContext
.Response;
Infrastructure\ControllerEndpointFilterInvocationContext.cs (1)
40
public override HttpContext HttpContext => ActionContext.
HttpContext
;
Infrastructure\FileContentResultExecutor.cs (1)
72
return WriteFileAsync(context.
HttpContext
, fileContentStream, range, rangeLength);
Infrastructure\FileResultExecutorBase.cs (1)
70
return FileResultHelper.SetHeadersAndLog(context.
HttpContext
, fileResultInfo, fileLength, enableRangeProcessing, lastModified, etag, Logger);
Infrastructure\FileStreamResultExecutor.cs (1)
84
return WriteFileAsync(context.
HttpContext
, result.FileStream, range, rangeLength);
Infrastructure\LocalRedirectResultExecutor.cs (3)
54
context.
HttpContext
.Response.StatusCode = result.Permanent ?
56
context.
HttpContext
.Response.Headers.Location = destinationUrl;
60
context.
HttpContext
.Response.Redirect(destinationUrl, result.Permanent);
Infrastructure\ObjectResultExecutor.cs (5)
86
context.
HttpContext
,
102
context.
HttpContext
.Response.StatusCode = statusCode;
104
if (context.
HttpContext
.RequestServices.GetService<IProblemDetailsService>() is { } problemDetailsService)
108
HttpContext = context.
HttpContext
,
128
var responseContentType = context.
HttpContext
.Response.ContentType;
Infrastructure\PhysicalFileResultExecutor.cs (1)
60
return WriteFileAsyncInternal(context.
HttpContext
, result, range, rangeLength, Logger);
Infrastructure\ProblemDetailsClientErrorFactory.cs (1)
17
var problemDetails = _problemDetailsFactory.CreateProblemDetails(actionContext.
HttpContext
, clientError.StatusCode);
Infrastructure\RedirectResultExecutor.cs (3)
51
context.
HttpContext
.Response.StatusCode = result.Permanent ?
53
context.
HttpContext
.Response.Headers.Location = destinationUrl;
57
context.
HttpContext
.Response.Redirect(destinationUrl, result.Permanent);
Infrastructure\RedirectToActionResultExecutor.cs (3)
57
context.
HttpContext
.Response.StatusCode = result.Permanent ?
59
context.
HttpContext
.Response.Headers.Location = destinationUrl;
63
context.
HttpContext
.Response.Redirect(destinationUrl, result.Permanent);
Infrastructure\RedirectToPageResultExecutor.cs (3)
57
context.
HttpContext
.Response.StatusCode = result.Permanent ?
59
context.
HttpContext
.Response.Headers.Location = destinationUrl;
63
context.
HttpContext
.Response.Redirect(destinationUrl, result.Permanent);
Infrastructure\RedirectToRouteResultExecutor.cs (3)
53
context.
HttpContext
.Response.StatusCode = result.Permanent ?
55
context.
HttpContext
.Response.Headers.Location = destinationUrl;
59
context.
HttpContext
.Response.Redirect(destinationUrl, result.Permanent);
Infrastructure\ResourceInvoker.cs (2)
106
actionContext.
HttpContext
,
136
actionContext.
HttpContext
,
Infrastructure\SystemTextJsonResultExecutor.cs (6)
41
var response = context.
HttpContext
.Response;
69
await JsonSerializer.SerializeAsync(responseWriter, value, objectType, jsonSerializerOptions, context.
HttpContext
.RequestAborted);
71
catch (OperationCanceledException) when (context.
HttpContext
.RequestAborted.IsCancellationRequested) { }
82
await JsonSerializer.SerializeAsync(transcodingStream, value, objectType, jsonSerializerOptions, context.
HttpContext
.RequestAborted);
83
await transcodingStream.FlushAsync(context.
HttpContext
.RequestAborted);
85
catch (OperationCanceledException) when (context.
HttpContext
.RequestAborted.IsCancellationRequested)
Infrastructure\VirtualFileResultExecutor.cs (1)
71
return WriteFileAsyncInternal(context.
HttpContext
, fileInfo, range, rangeLength, Logger);
JsonResult.cs (1)
74
var services = context.
HttpContext
.RequestServices;
LocalRedirectResult.cs (1)
91
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<LocalRedirectResult>>();
ModelBinding\DefaultModelBindingContext.cs (1)
235
var mvcOptions = actionContext.
HttpContext
.RequestServices?.GetService<IOptions<MvcOptions>>();
ModelBinding\FormFileValueProviderFactory.cs (1)
21
var request = context.ActionContext.
HttpContext
.Request;
ModelBinding\FormValueProviderFactory.cs (2)
22
var request = context.ActionContext.
HttpContext
.Request;
34
var request = context.ActionContext.
HttpContext
.Request;
ModelBinding\JQueryFormValueProviderFactory.cs (2)
22
var request = context.ActionContext.
HttpContext
.Request;
34
var request = context.ActionContext.
HttpContext
.Request;
ModelBinding\JQueryQueryStringValueProviderFactory.cs (1)
20
var query = context.ActionContext.
HttpContext
.Request.Query;
ModelBinding\QueryStringValueProviderFactory.cs (1)
21
var query = context.ActionContext.
HttpContext
.Request.Query;
ObjectResult.cs (2)
62
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<ObjectResult>>();
87
context.
HttpContext
.Response.StatusCode = StatusCode.Value;
PhysicalFileResult.cs (1)
58
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<PhysicalFileResult>>();
RedirectResult.cs (1)
93
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<RedirectResult>>();
RedirectToActionResult.cs (1)
171
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToActionResult>>();
RedirectToPageResult.cs (1)
209
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToPageResult>>();
RedirectToRouteResult.cs (1)
163
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<RedirectToRouteResult>>();
RequireHttpsAttribute.cs (4)
45
if (!filterContext.
HttpContext
.Request.IsHttps)
66
if (!HttpMethods.IsGet(filterContext.
HttpContext
.Request.Method))
72
var optionsAccessor = filterContext.
HttpContext
.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
74
var request = filterContext.
HttpContext
.Request;
Routing\EndpointRoutingUrlHelper.cs (2)
69
ActionContext.
HttpContext
,
82
ActionContext.
HttpContext
,
Routing\UrlHelper.cs (1)
28
protected HttpContext HttpContext => ActionContext.
HttpContext
;
Routing\UrlHelperBase.cs (7)
51
public virtual string? Content(string? contentPath) => Content(ActionContext.
HttpContext
, contentPath);
60
Protocol = ActionContext.
HttpContext
.Request.Scheme,
61
Host = ActionContext.
HttpContext
.Request.Host.ToUriComponent()
131
var pathBase = ActionContext.
HttpContext
.Request.PathBase;
149
host = string.IsNullOrEmpty(host) ? ActionContext.
HttpContext
.Request.Host.Value : host;
211
host = string.IsNullOrEmpty(host) ? ActionContext.
HttpContext
.Request.Host.Value : host;
470
var pathBase = ActionContext.
HttpContext
.Request.PathBase;
Routing\UrlHelperFactory.cs (2)
21
var httpContext = context.
HttpContext
;
26
nameof(ActionContext.
HttpContext
),
SignInResult.cs (1)
82
var httpContext = context.
HttpContext
;
SignOutResult.cs (1)
94
return ExecuteAsync(context.
HttpContext
);
StatusCodeResult.cs (1)
38
var httpContext = context.
HttpContext
;
UrlHelperExtensions.cs (2)
525
var httpContext = helper.ActionContext.
HttpContext
;
574
var httpContext = urlHelper.ActionContext.
HttpContext
;
VirtualFileResult.cs (1)
64
var executor = context.
HttpContext
.RequestServices.GetRequiredService<IActionResultExecutor<VirtualFileResult>>();
Microsoft.AspNetCore.Mvc.Core.Test (119)
AcceptedAtActionResultTests.cs (2)
202
context.
HttpContext
.RequestServices = new ForwardingServiceProvider();
209
var header = context.
HttpContext
.Response.Headers.Last();
Authorization\AuthorizeFilterTest.cs (6)
27
Assert.Contains(authorizationContext.
HttpContext
.User.Identities, i => i.IsAuthenticated);
42
authorizationContext.
HttpContext
.RequestServices);
90
authorizationContext.
HttpContext
.User = new ClaimsPrincipal();
214
Assert.NotNull(authorizationContext.
HttpContext
.User?.Identity);
552
ActionContext.
HttpContext
.RequestServices = new ServiceCollection()
556
ActionContext.
HttpContext
.SetEndpoint(new Endpoint(
Controllers\ControllerBinderDelegateProviderTest.cs (2)
808
controllerContext.
HttpContext
.Request.Method = "GET";
871
controllerContext.
HttpContext
.Request.Method = "POST";
FileResultHelperTest.cs (1)
499
var executor = context.
HttpContext
.RequestServices.GetRequiredService<EmptyFileResultExecutor>();
Filters\DisableRequestSizeLimitFilterTest.cs (4)
23
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
42
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
84
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
105
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Filters\FilterFactoryTest.cs (3)
213
var filter = new TestFilter(providerContext.ActionContext.
HttpContext
.Items["name"] as string);
231
actionContext.
HttpContext
.Items["name"] = "foo";
243
actionContext.
HttpContext
.Items["name"] = "bar";
Filters\MiddlewareFilterTest.cs (6)
40
var feature = resourceExecutingContext.
HttpContext
.Features.Get<IMiddlewareFilterFeature>();
77
Assert.True(resourceExecutedContext.
HttpContext
.Response.Headers.ContainsKey(expectedHeader));
125
var response = resourceExecutedContext.
HttpContext
.Response;
211
var response = resourceExecutedContext.
HttpContext
.Response;
499
context.
HttpContext
.Response.StatusCode = 200;
500
return context.
HttpContext
.Response.WriteAsync("Shortcircuited");
Filters\RequestFormLimitsFilterTest.cs (9)
25
authorizationFilterContext.
HttpContext
.Features.Set<IFormFeature>(null);
31
var formFeature = authorizationFilterContext.
HttpContext
.Features.Get<IFormFeature>();
43
var oldFormFeature = new FormFeature(authorizationFilterContext.
HttpContext
.Request);
45
authorizationFilterContext.
HttpContext
.Features.Set<IFormFeature>(oldFormFeature);
51
var actualFormFeature = authorizationFilterContext.
HttpContext
.Features.Get<IFormFeature>();
66
authorizationFilterContext.
HttpContext
.Request.Form = new FormCollection(null);
91
authorizationFilterContext.
HttpContext
.Features.Set<IFormFeature>(null);
116
authorizationFilterContext.
HttpContext
.Features.Set<IFormFeature>(
117
new FormFeature(authorizationFilterContext.
HttpContext
.Request));
Filters\RequestSizeLimitFilterTest.cs (4)
24
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
45
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
89
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
111
authorizationFilterContext.
HttpContext
.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Filters\ResponseCacheFilterExecutorTest.cs (14)
29
Assert.Equal("no-store", context.
HttpContext
.Response.Headers["Cache-control"]);
188
Assert.Equal(output, context.
HttpContext
.Response.Headers["Cache-control"]);
245
Assert.Equal(output, context.
HttpContext
.Response.Headers["Cache-control"]);
325
Assert.Equal(varyOutput, context.
HttpContext
.Response.Headers["Vary"]);
326
Assert.Equal(cacheControlOutput, context.
HttpContext
.Response.Headers["Cache-control"]);
402
context.
HttpContext
.Features.Set<IResponseCachingFeature>(new ResponseCachingFeature());
408
Assert.Equal(varyOutput, context.
HttpContext
.Features.Get<IResponseCachingFeature>().VaryByQueryKeys);
409
Assert.Equal(cacheControlOutput, context.
HttpContext
.Response.Headers.CacheControl);
450
Assert.Equal("no-store,no-cache", context.
HttpContext
.Response.Headers["Cache-control"]);
451
Assert.Equal("no-cache", context.
HttpContext
.Response.Headers["Pragma"]);
470
Assert.Equal("public,max-age=20", context.
HttpContext
.Response.Headers["Cache-control"]);
490
Assert.Equal("private,max-age=10", context.
HttpContext
.Response.Headers["Cache-control"]);
510
Assert.Equal("public,max-age=10", context.
HttpContext
.Response.Headers["Cache-control"]);
530
Assert.Equal("Test", context.
HttpContext
.Response.Headers["Vary"]);
Formatters\JsonOutputFormatterTestBase.cs (4)
41
actionContext.
HttpContext
,
92
actionContext.
HttpContext
,
124
actionContext.
HttpContext
,
185
actionContext.
HttpContext
,
Formatters\SystemTextJsonOutputFormatterTest.cs (7)
46
actionContext.
HttpContext
,
74
actionContext.
HttpContext
,
101
actionContext.
HttpContext
,
126
actionContext.
HttpContext
.RequestAborted = cts.Token;
130
actionContext.
HttpContext
,
192
actionContext.
HttpContext
,
232
actionContext.
HttpContext
,
HttpOkResultTest.cs (1)
39
Assert.Equal(StatusCodes.Status200OK, context.
HttpContext
.Response.StatusCode);
Infrastructure\ControllerActionInvokerTest.cs (1)
1961
context.
HttpContext
.Items["Result"] = Value;
Infrastructure\JsonResultExecutorTestBase.cs (32)
37
var written = GetWrittenBytes(context.
HttpContext
);
39
Assert.Equal("application/json; charset=utf-8", context.
HttpContext
.Response.ContentType);
58
var written = GetWrittenBytes(context.
HttpContext
);
60
Assert.Equal("text/json", context.
HttpContext
.Response.ContentType);
70
context.
HttpContext
.Response.ContentType = "text/json; charset=utf-8";
82
var written = GetWrittenBytes(context.
HttpContext
);
84
Assert.Equal("text/json; charset=utf-16", context.
HttpContext
.Response.ContentType);
94
context.
HttpContext
.Response.ContentType = "text/json; charset=utf-16";
102
var written = GetWrittenBytes(context.
HttpContext
);
104
Assert.Equal("text/json; charset=utf-16", context.
HttpContext
.Response.ContentType);
126
var written = GetWrittenBytes(context.
HttpContext
);
128
Assert.Equal("text/json; charset=us-ascii", context.
HttpContext
.Response.ContentType);
139
context.
HttpContext
.Response.ContentType = expectedContentType;
148
var written = GetWrittenBytes(context.
HttpContext
);
150
Assert.Equal(expectedContentType, context.
HttpContext
.Response.ContentType);
164
context.
HttpContext
.Response.ContentType = responseContentType;
173
var written = GetWrittenBytes(context.
HttpContext
);
175
Assert.Equal(expectedContentType, context.
HttpContext
.Response.ContentType);
197
var written = GetWrittenBytes(context.
HttpContext
);
199
Assert.Equal("application/json; charset=utf-8", context.
HttpContext
.Response.ContentType);
228
var written = GetWrittenBytes(context.
HttpContext
);
280
context.
HttpContext
.Response.Body = stream.Object;
323
var written = GetWrittenBytes(context.
HttpContext
);
341
var written = GetWrittenBytes(context.
HttpContext
);
359
var written = GetWrittenBytes(context.
HttpContext
);
368
context.
HttpContext
.RequestAborted = cts.Token;
377
var written = GetWrittenBytes(context.
HttpContext
);
399
context.
HttpContext
.RequestAborted = cts.Token;
411
var written = GetWrittenBytes(context.
HttpContext
);
433
context.
HttpContext
.RequestAborted = cts.Token;
453
context.
HttpContext
.RequestAborted = cts.Token;
461
var written = GetWrittenBytes(context.
HttpContext
);
Infrastructure\ObjectResultExecutorTest.cs (6)
276
Assert.Equal(StatusCodes.Status406NotAcceptable, actionContext.
HttpContext
.Response.StatusCode);
301
actionContext.
HttpContext
.Response.Headers.ContentType);
389
actionContext.
HttpContext
.Request.Headers.Accept = acceptHeader;
395
Assert.Equal(expectedContentType, actionContext.
HttpContext
.Response.Headers.ContentType);
426
actionContext.
HttpContext
.Request.Headers.Accept = acceptHeader;
432
var responseContentType = actionContext.
HttpContext
.Response.Headers.ContentType;
ModelBinding\FormFileValueProviderFactoryTest.cs (1)
48
var files = (FormFileCollection)context.ActionContext.
HttpContext
.Request.Form.Files;
ObjectResultTests.cs (3)
59
Assert.Equal(404, actionContext.
HttpContext
.Response.StatusCode);
122
Assert.Equal(StatusCodes.Status413RequestEntityTooLarge, actionContext.
HttpContext
.Response.StatusCode);
153
Assert.Equal(StatusCodes.Status400BadRequest, actionContext.
HttpContext
.Response.StatusCode);
ResponseCacheAttributeTest.cs (5)
213
context.
HttpContext
.Features.Set<IResponseCachingFeature>(new ResponseCachingFeature());
219
var response = context.
HttpContext
.Response;
227
Assert.Equal(varyByQueryKeys, context.
HttpContext
.Features.Get<IResponseCachingFeature>().VaryByQueryKeys);
277
Assert.True(context.
HttpContext
.Response.Headers.TryGetValue("Cache-Control", out values));
296
Assert.True(context.
HttpContext
.Response.Headers.TryGetValue("Cache-Control", out values));
Routing\EndpointRoutingUrlHelperTest.cs (3)
55
urlHelper.ActionContext.
HttpContext
.SetEndpoint(endpoint1);
56
urlHelper.ActionContext.
HttpContext
.Request.RouteValues = new RouteValueDictionary
140
var httpContext = actionContext.
HttpContext
;
Routing\UrlHelperTestBase.cs (5)
921
Assert.Same(urlHelper, actionContext.
HttpContext
.Items[typeof(IUrlHelper)] as IUrlHelper);
944
Assert.Same(urlHelper, actionContext.
HttpContext
.Items[typeof(IUrlHelper)] as IUrlHelper);
968
urlHelper.ActionContext.
HttpContext
.Features.Set<IRouteValuesFeature>(new RouteValuesFeature
1007
urlHelper.ActionContext.
HttpContext
.Features.Set<IRouteValuesFeature>(new RouteValuesFeature
1047
urlHelper.ActionContext.
HttpContext
.Features.Set<IRouteValuesFeature>(new RouteValuesFeature
Microsoft.AspNetCore.Mvc.Cors (5)
CorsAuthorizationFilter.cs (3)
74
var httpContext = context.
HttpContext
;
86
var result = _corsService.EvaluatePolicy(context.
HttpContext
, policy);
87
_corsService.ApplyResult(result, context.
HttpContext
.Response);
DisableCorsAuthorizationFilter.cs (2)
27
context.
HttpContext
.Request.Headers[CorsConstants.AccessControlRequestMethod];
29
context.
HttpContext
.Request.Method,
Microsoft.AspNetCore.Mvc.Cors.Test (7)
CorsAuthorizationFilterTest.cs (7)
33
authorizationContext.
HttpContext
.Request.Method = preflightRequestMethod;
40
var response = authorizationContext.
HttpContext
.Response;
69
Assert.Equal(204, authorizationContext.
HttpContext
.Response.StatusCode);
70
Assert.Empty(authorizationContext.
HttpContext
.Response.Headers);
90
var response = authorizationContext.
HttpContext
.Response;
112
Assert.Equal(200, authorizationContext.
HttpContext
.Response.StatusCode);
113
Assert.Empty(authorizationContext.
HttpContext
.Response.Headers);
Microsoft.AspNetCore.Mvc.DataAnnotations (2)
DataAnnotationsModelValidator.cs (1)
76
serviceProvider: validationContext.ActionContext?.
HttpContext
?.RequestServices,
ValidatableObjectAdapter.cs (1)
35
serviceProvider: context.ActionContext?.
HttpContext
?.RequestServices,
Microsoft.AspNetCore.Mvc.IntegrationTests (56)
BindingSourceMetadataProviderIntegrationTest.cs (1)
43
var token = testContext.
HttpContext
.RequestAborted;
BindPropertyIntegrationTest.cs (1)
230
HttpContext = testContext.
HttpContext
,
BodyValidationIntegrationTests.cs (9)
379
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
420
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
456
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
562
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
627
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
672
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
720
var httpContext = testContext.
HttpContext
;
827
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
873
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
CancellationTokenModelBinderIntegrationTest.cs (3)
47
testContext.
HttpContext
.Abort();
83
testContext.
HttpContext
.Abort();
121
testContext.
HttpContext
.Abort();
ComplexRecordIntegrationTest.cs (1)
4253
context.
HttpContext
.RequestServices);
ComplexTypeIntegrationTestBase.cs (1)
3752
context.
HttpContext
.RequestServices);
DictionaryModelBinderIntegrationTest.cs (9)
551
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
589
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
624
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
659
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
744
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
948
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
982
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
1021
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
1060
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
ExcludeBindingMetadataProviderIntegrationTest.cs (1)
95
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
HeaderModelBinderIntegrationTest.cs (8)
43
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
82
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
124
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
170
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
217
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
277
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
280
var httpContext = testContext.
HttpContext
;
331
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
KeyValuePairModelBinderIntegrationTest.cs (2)
112
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
199
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
ModelBindingTestContext.cs (1)
16
return (T)
HttpContext
.RequestServices.GetService(typeof(T));
ModelBindingTestHelper.cs (1)
64
return GetParameterBinder(testContext.
HttpContext
.RequestServices);
ParameterBinderExtensions.cs (3)
21
var optionsAccessor = context.
HttpContext
.RequestServices.GetService<IOptions<MvcOptions>>();
23
var modelMetadataProvider = context.
HttpContext
.RequestServices.GetService<IModelMetadataProvider>();
65
context.
HttpContext
.RequestServices);
ServicesModelBinderIntegrationTest.cs (2)
356
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
394
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
SimpleTypeModelBinderIntegrationTest.cs (2)
432
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
535
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
TryValidateModelIntegrationTest.cs (1)
213
var options = actionContext.
HttpContext
.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
ValidationIntegrationTests.cs (5)
1745
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
1796
var httpContext = testContext.
HttpContext
;
1840
var httpContext = testContext.
HttpContext
;
1885
var httpContext = testContext.
HttpContext
;
1932
var httpContext = testContext.
HttpContext
;
ValidationWithRecordIntegrationTests.cs (5)
1548
var parameterBinder = ModelBindingTestHelper.GetParameterBinder(testContext.
HttpContext
.RequestServices);
1599
var httpContext = testContext.
HttpContext
;
1643
var httpContext = testContext.
HttpContext
;
1688
var httpContext = testContext.
HttpContext
;
1735
var httpContext = testContext.
HttpContext
;
Microsoft.AspNetCore.Mvc.NewtonsoftJson (4)
NewtonsoftJsonResultExecutor.cs (4)
75
var response = context.
HttpContext
.Response;
110
value = await reader(value, context.
HttpContext
.RequestAborted);
112
catch (OperationCanceledException) when (context.
HttpContext
.RequestAborted.IsCancellationRequested) { }
113
if (context.
HttpContext
.RequestAborted.IsCancellationRequested)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (49)
JsonResultTest.cs (2)
34
var written = GetWrittenBytes(context.
HttpContext
);
36
Assert.Equal("application/json; charset=utf-8", context.
HttpContext
.Response.ContentType);
NewtonsoftJsonOutputFormatterTest.cs (9)
444
actionContext.
HttpContext
.RequestAborted = cts.Token;
445
actionContext.
HttpContext
.RequestServices = new ServiceCollection().AddLogging().BuildServiceProvider();
449
actionContext.
HttpContext
,
489
actionContext.
HttpContext
.RequestAborted = cts.Token;
490
actionContext.
HttpContext
.RequestServices = new ServiceCollection().AddLogging().BuildServiceProvider();
494
actionContext.
HttpContext
,
523
actionContext.
HttpContext
.RequestAborted = cts.Token;
524
actionContext.
HttpContext
.RequestServices = new ServiceCollection().AddLogging().BuildServiceProvider();
528
actionContext.
HttpContext
,
NewtonsoftJsonResultExecutorTest.cs (2)
39
context.
HttpContext
.RequestAborted = cts.Token;
48
var written = GetWrittenBytes(context.
HttpContext
);
src\Mvc\Mvc.Core\test\Formatters\JsonOutputFormatterTestBase.cs (4)
41
actionContext.
HttpContext
,
92
actionContext.
HttpContext
,
124
actionContext.
HttpContext
,
185
actionContext.
HttpContext
,
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (32)
37
var written = GetWrittenBytes(context.
HttpContext
);
39
Assert.Equal("application/json; charset=utf-8", context.
HttpContext
.Response.ContentType);
58
var written = GetWrittenBytes(context.
HttpContext
);
60
Assert.Equal("text/json", context.
HttpContext
.Response.ContentType);
70
context.
HttpContext
.Response.ContentType = "text/json; charset=utf-8";
82
var written = GetWrittenBytes(context.
HttpContext
);
84
Assert.Equal("text/json; charset=utf-16", context.
HttpContext
.Response.ContentType);
94
context.
HttpContext
.Response.ContentType = "text/json; charset=utf-16";
102
var written = GetWrittenBytes(context.
HttpContext
);
104
Assert.Equal("text/json; charset=utf-16", context.
HttpContext
.Response.ContentType);
126
var written = GetWrittenBytes(context.
HttpContext
);
128
Assert.Equal("text/json; charset=us-ascii", context.
HttpContext
.Response.ContentType);
139
context.
HttpContext
.Response.ContentType = expectedContentType;
148
var written = GetWrittenBytes(context.
HttpContext
);
150
Assert.Equal(expectedContentType, context.
HttpContext
.Response.ContentType);
164
context.
HttpContext
.Response.ContentType = responseContentType;
173
var written = GetWrittenBytes(context.
HttpContext
);
175
Assert.Equal(expectedContentType, context.
HttpContext
.Response.ContentType);
197
var written = GetWrittenBytes(context.
HttpContext
);
199
Assert.Equal("application/json; charset=utf-8", context.
HttpContext
.Response.ContentType);
228
var written = GetWrittenBytes(context.
HttpContext
);
280
context.
HttpContext
.Response.Body = stream.Object;
323
var written = GetWrittenBytes(context.
HttpContext
);
341
var written = GetWrittenBytes(context.
HttpContext
);
359
var written = GetWrittenBytes(context.
HttpContext
);
368
context.
HttpContext
.RequestAborted = cts.Token;
377
var written = GetWrittenBytes(context.
HttpContext
);
399
context.
HttpContext
.RequestAborted = cts.Token;
411
var written = GetWrittenBytes(context.
HttpContext
);
433
context.
HttpContext
.RequestAborted = cts.Token;
453
context.
HttpContext
.RequestAborted = cts.Token;
461
var written = GetWrittenBytes(context.
HttpContext
);
Microsoft.AspNetCore.Mvc.Razor (18)
DefaultTagHelperFactory.cs (1)
75
var serviceProvider = context.
HttpContext
.RequestServices;
Infrastructure\DefaultTagHelperActivator.cs (1)
21
return Cache<TTagHelper>.Create(context.
HttpContext
.RequestServices);
MvcRazorDiagnosticListenerExtensions.cs (2)
37
viewContext.
HttpContext
67
viewContext.
HttpContext
RazorPage.cs (1)
23
public HttpContext Context => ViewContext?.
HttpContext
!;
RazorPageBase.cs (7)
134
public virtual ClaimsPrincipal User => ViewContext.
HttpContext
.User;
150
var services = ViewContext.
HttpContext
.RequestServices;
164
var services = ViewContext.
HttpContext
.RequestServices;
355
var services = viewContext.
HttpContext
.RequestServices;
701
await ViewContext.
HttpContext
.Response.Body.FlushAsync();
716
var antiforgery = viewContext.
HttpContext
.RequestServices.GetRequiredService<IAntiforgery>();
717
antiforgery.SetCookieTokenAndHeader(viewContext.
HttpContext
);
RazorPagePropertyActivator.cs (2)
85
var serviceProvider = context.
HttpContext
.RequestServices;
126
var serviceProvider = context.
HttpContext
.RequestServices;
RazorView.cs (1)
84
_bufferScope = context.
HttpContext
.RequestServices.GetRequiredService<IViewBufferScope>();
ServiceBasedTagHelperActivator.cs (1)
21
return context.
HttpContext
.RequestServices.GetRequiredService<TTagHelper>();
TagHelpers\TagHelperComponentTagHelper.cs (1)
61
var serviceProvider = ViewContext.
HttpContext
.RequestServices;
TagHelpers\UrlResolutionTagHelper.cs (1)
340
return ViewContext.
HttpContext
.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
Microsoft.AspNetCore.Mvc.Razor.Test (2)
TagHelpers\TagHelperComponentPropertyActivatorTest.cs (1)
57
var viewContext = Mock.Of<ViewContext>(vc => vc.
HttpContext
== httpContext);
TagHelpers\TagHelperComponentTagHelperTest.cs (1)
395
var viewContext = Mock.Of<ViewContext>(vc => vc.
HttpContext
== httpContext);
Microsoft.AspNetCore.Mvc.RazorPages (15)
ApplicationModels\DefaultPageApplicationModelPartsProvider.cs (1)
25
_supportsNonGetRequests = context => !HttpMethods.IsGet(context.
HttpContext
.Request.Method);
Filters\PageSaveTempDataPropertyFilter.cs (1)
23
var tempData = _tempDataFactory.GetTempData(context.
HttpContext
);
Filters\PageViewDataAttributeFilter.cs (1)
27
context.
HttpContext
.Features.Set<IViewDataValuesProviderFeature>(this);
Infrastructure\DefaultPageHandlerMethodSelector.cs (3)
88
var httpMethod = context.
HttpContext
.Request.Method;
155
if (context.
HttpContext
.Request.Query.TryGetValue(Handler, out var queryValues))
166
return HttpMethods.IsHead(context.
HttpContext
.Request.Method) ? HttpMethods.Get : null;
Infrastructure\DefaultPageModelActivatorProvider.cs (1)
33
return (context) => factory(context.
HttpContext
.RequestServices, Array.Empty<object>());
Infrastructure\HandleOptionsRequestsPageFilter.cs (1)
41
HttpMethods.IsOptions(context.
HttpContext
.Request.Method))
Infrastructure\PageActionInvoker.cs (2)
114
_tempDataFactory.GetTempData(_pageContext.
HttpContext
),
153
_tempDataFactory.GetTempData(_pageContext.
HttpContext
),
Infrastructure\PageResultExecutor.cs (1)
99
var viewDataValuesProvider = pageContext.
HttpContext
.Features.Get<IViewDataValuesProviderFeature>();
Infrastructure\ServiceBasedPageModelActivatorProvider.cs (1)
29
return context.
HttpContext
.RequestServices.GetRequiredService(modelType);
PageBase.cs (1)
42
public HttpContext HttpContext => PageContext?.
HttpContext
!;
PageModel.cs (1)
61
public HttpContext HttpContext => PageContext.
HttpContext
;
PageResult.cs (1)
60
var executor = context.
HttpContext
.RequestServices.GetRequiredService<PageResultExecutor>();
Microsoft.AspNetCore.Mvc.RazorPages.Test (11)
Infrastructure\DefaultPageFactoryProviderTest.cs (4)
229
HttpContext = pageContext.
HttpContext
,
268
HttpContext = pageContext.
HttpContext
,
311
HttpContext = pageContext.
HttpContext
,
349
HttpContext = pageContext.
HttpContext
,
Infrastructure\DisallowOptionsRequestsPageFilterTest.cs (5)
47
context.
HttpContext
.Request.Method = "PUT";
63
context.
HttpContext
.Request.Method = "DELETE";
80
context.
HttpContext
.Request.Method = "Options";
98
context.
HttpContext
.Request.Method = "Options";
114
context.
HttpContext
.Request.Method = "Options";
Infrastructure\PageActionInvokerProviderTest.cs (2)
141
Assert.Same(context.ActionContext.
HttpContext
, pageContext.
HttpContext
);
Microsoft.AspNetCore.Mvc.TagHelpers (16)
Cache\CacheTagKey.cs (1)
81
var httpContext = tagHelper.ViewContext.
HttpContext
;
ComponentTagHelper.cs (2)
96
var requestServices = ViewContext.
HttpContext
.RequestServices;
100
var result = await componentPrerenderer.PrerenderComponentAsync(ViewContext.
HttpContext
, ComponentType, renderMode, parameters);
ImageTagHelper.cs (2)
136
FileVersionProvider = ViewContext.
HttpContext
.RequestServices.GetRequiredService<IFileVersionProvider>();
144
var pathBase = ViewContext.
HttpContext
.Request.PathBase;
LinkTagHelper.cs (3)
477
ViewContext.
HttpContext
.Request.PathBase);
485
FileVersionProvider = ViewContext.
HttpContext
.RequestServices.GetRequiredService<IFileVersionProvider>();
536
var pathBase = ViewContext.
HttpContext
.Request.PathBase;
PersistComponentStateTagHelper.cs (2)
46
var componentPrerenderer = ViewContext.
HttpContext
.RequestServices.GetRequiredService<IComponentPrerenderer>();
55
var content = await componentPrerenderer.PrerenderPersistedStateAsync(ViewContext.
HttpContext
, serializationMode);
ResourceCollectionUtilities.cs (2)
14
var pathBase = viewContext.
HttpContext
.Request.PathBase;
15
var assetCollection = viewContext.
HttpContext
.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
ScriptTagHelper.cs (4)
247
var importMap = ImportMap ?? ViewContext.
HttpContext
.GetEndpoint()?.Metadata.GetMetadata<ImportMapDefinition>();
416
var pathBase = ViewContext.
HttpContext
.Request.PathBase;
465
ViewContext.
HttpContext
.Request.PathBase);
473
FileVersionProvider = ViewContext.
HttpContext
.RequestServices.GetRequiredService<IFileVersionProvider>();
Microsoft.AspNetCore.Mvc.TagHelpers.Test (44)
CacheTagHelperTest.cs (4)
105
cacheTagHelper1.ViewContext.
HttpContext
.Request.QueryString = new QueryString(
127
cacheTagHelper2.ViewContext.
HttpContext
.Request.QueryString = new QueryString(
156
cacheTagHelper1.ViewContext.
HttpContext
.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";
178
cacheTagHelper2.ViewContext.
HttpContext
.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";
CacheTagKeyTest.cs (7)
211
cacheTagHelper.ViewContext.
HttpContext
.Request.Headers["Cookie"] =
237
var headers = cacheTagHelper.ViewContext.
HttpContext
.Request.Headers;
265
cacheTagHelper.ViewContext.
HttpContext
.Request.QueryString =
359
cacheTagHelper.ViewContext.
HttpContext
.User = new ClaimsPrincipal(identity);
404
cacheTagHelper.ViewContext.
HttpContext
.Request.Headers["Content-Type"] = "text/html";
406
cacheTagHelper.ViewContext.
HttpContext
.User = new ClaimsPrincipal(identity);
431
cacheTagHelper.ViewContext.
HttpContext
.Request.Headers["Content-Type"] = "text/html";
ComponentTagHelperTest.cs (1)
39
var prerenderer = viewContext.
HttpContext
.RequestServices.GetRequiredService<IComponentPrerenderer>();
DistributedCacheTagHelperTest.cs (4)
148
cacheTagHelper1.ViewContext.
HttpContext
.Request.QueryString = new QueryString(
173
cacheTagHelper2.ViewContext.
HttpContext
.Request.QueryString = new QueryString(
208
cacheTagHelper1.ViewContext.
HttpContext
.Request.Headers["Cookie"] = "cookie1=value1;cookie2=value2";
232
cacheTagHelper2.ViewContext.
HttpContext
.Request.Headers["Cookie"] = "cookie1=value1;cookie2=not-value2";
FormTagHelperTest.cs (1)
154
viewContext.
HttpContext
.Request.Path = "/home/index";
ImageTagHelperTest.cs (3)
197
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
200
helper.ViewContext.
HttpContext
.Request.PathBase = new PathString(pathBase);
296
actionContext.
HttpContext
.Request.PathBase = new Http.PathString(requestPathBase);
LinkTagHelperTest.cs (6)
750
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
791
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
792
helper.ViewContext.
HttpContext
.Request.PathBase = "/approot";
925
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
1080
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
1127
actionContext.
HttpContext
.Request.PathBase = new PathString(requestPathBase);
PersistComponentStateTagHelperTest.cs (8)
88
var manager = tagHelper.ViewContext.
HttpContext
.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
114
EndpointHtmlRenderer.UpdateSaveStateRenderMode(tagHelper.ViewContext.
HttpContext
, RenderMode.InteractiveWebAssembly);
118
var manager = tagHelper.ViewContext.
HttpContext
.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
147
var manager = tagHelper.ViewContext.
HttpContext
.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
196
EndpointHtmlRenderer.UpdateSaveStateRenderMode(tagHelper.ViewContext.
HttpContext
, Components.Web.RenderMode.InteractiveServer);
200
var manager = tagHelper.ViewContext.
HttpContext
.RequestServices.GetRequiredService<ComponentStatePersistenceManager>();
228
EndpointHtmlRenderer.UpdateSaveStateRenderMode(tagHelper.ViewContext.
HttpContext
, Components.Web.RenderMode.InteractiveServer);
229
EndpointHtmlRenderer.UpdateSaveStateRenderMode(tagHelper.ViewContext.
HttpContext
, Components.Web.RenderMode.InteractiveWebAssembly);
ScriptTagHelperTest.cs (10)
659
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
696
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
697
helper.ViewContext.
HttpContext
.Request.PathBase = "/approot";
742
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
786
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint(importMap));
882
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
1012
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
1051
helper.ViewContext.
HttpContext
.SetEndpoint(CreateEndpoint());
1052
helper.ViewContext.
HttpContext
.Request.PathBase = "/approot";
1108
actionContext.
HttpContext
.Request.PathBase = new PathString(requestPathBase);
Microsoft.AspNetCore.Mvc.ViewFeatures (50)
DefaultDisplayTemplates.cs (2)
92
var serviceProvider = htmlHelper.ViewContext.
HttpContext
.RequestServices;
208
var serviceProvider = htmlHelper.ViewContext.
HttpContext
.RequestServices;
DefaultEditorTemplates.cs (2)
74
var serviceProvider = htmlHelper.ViewContext.
HttpContext
.RequestServices;
250
var serviceProvider = htmlHelper.ViewContext.
HttpContext
.RequestServices;
DefaultHtmlGenerator.cs (2)
183
return _antiforgery.GetHtml(viewContext.
HttpContext
);
281
var request = viewContext.
HttpContext
.Request;
Filters\AntiforgeryMiddlewareAuthorizationFilter.cs (2)
19
if (context.
HttpContext
.Items.ContainsKey(AntiforgeryMiddlewareWithEndpointInvokedKey))
21
var antiforgeryValidationFeature = context.
HttpContext
.Features.Get<IAntiforgeryValidationFeature>();
Filters\AutoValidateAntiforgeryTokenAuthorizationFilter.cs (1)
22
var method = context.
HttpContext
.Request.Method;
Filters\ControllerSaveTempDataPropertyFilter.cs (1)
23
var tempData = _tempDataFactory.GetTempData(context.
HttpContext
);
Filters\ControllerViewDataAttributeFilter.cs (1)
26
context.
HttpContext
.Features.Set<IViewDataValuesProviderFeature>(this);
Filters\SaveTempDataFilter.cs (10)
32
if (!context.
HttpContext
.Items.ContainsKey(SaveTempDataFilterContextKey))
39
context.
HttpContext
.Items.Add(SaveTempDataFilterContextKey, tempDataContext);
42
if (!context.
HttpContext
.Response.HasStarted)
44
context.
HttpContext
.Response.OnStarting(
46
state: context.
HttpContext
);
84
if (!context.
HttpContext
.Response.HasStarted && context.Exception != null)
86
var saveTempDataContext = GetTempDataContext(context.
HttpContext
);
105
if (!context.
HttpContext
.Response.HasStarted)
107
SaveTempData(context.Result, _factory, context.Filters, context.
HttpContext
);
109
var saveTempDataContext = GetTempDataContext(context.
HttpContext
);
Filters\ValidateAntiforgeryTokenAuthorizationFilter.cs (1)
37
await _antiforgery.ValidateRequestAsync(context.
HttpContext
);
NameAndIdProvider.cs (2)
43
var items = viewContext.
HttpContext
.Items;
142
var items = viewContext.
HttpContext
.Items;
PageRemoteAttribute.cs (1)
43
var services = context.ActionContext.
HttpContext
.RequestServices;
PartialViewResult.cs (1)
64
var services = context.
HttpContext
.RequestServices;
RemoteAttribute.cs (1)
111
var services = context.ActionContext.
HttpContext
.RequestServices;
RemoteAttributeBase.cs (1)
179
var services = context.ActionContext.
HttpContext
.RequestServices;
Rendering\HtmlHelperComponentExtensions.cs (1)
62
var httpContext = htmlHelper.ViewContext.
HttpContext
;
SkipStatusCodePagesAttribute.cs (1)
26
var statusCodeFeature = context.
HttpContext
.Features.Get<IStatusCodePagesFeature>();
TemplateRenderer.cs (1)
240
var newHelper = viewContext.
HttpContext
.RequestServices.GetRequiredService<IHtmlHelper>();
ViewComponent.cs (6)
34
public HttpContext HttpContext => ViewContext?.
HttpContext
!;
39
public HttpRequest Request => ViewContext?.
HttpContext
?.Request!;
44
public IPrincipal User => ViewContext?.
HttpContext
?.User!;
49
public ClaimsPrincipal UserClaimsPrincipal => ViewContext?.
HttpContext
?.User!;
87
var services = ViewComponentContext.ViewContext?.
HttpContext
?.RequestServices;
151
var services = ViewComponentContext.ViewContext?.
HttpContext
?.RequestServices;
ViewComponentResult.cs (1)
63
var services = context.
HttpContext
.RequestServices;
ViewComponentResultExecutor.cs (4)
72
var response = context.
HttpContext
.Response;
83
tempData = _tempDataDictionaryFactory.GetTempData(context.
HttpContext
);
113
var viewComponentHelper = context.
HttpContext
.RequestServices.GetRequiredService<IViewComponentHelper>();
138
var viewDataValuesProvider = viewContext.
HttpContext
.Features.Get<IViewDataValuesProviderFeature>();
ViewComponents\DefaultViewComponentActivator.cs (1)
49
context.ViewContext.
HttpContext
.RequestServices,
ViewComponents\ServiceBasedViewComponentActivator.cs (1)
21
return context.ViewContext.
HttpContext
.RequestServices.GetRequiredService(viewComponentType);
ViewComponents\ViewViewComponentResult.cs (2)
113
_diagnosticListener = viewContext.
HttpContext
.RequestServices.GetRequiredService<DiagnosticListener>();
131
return context.ViewContext.
HttpContext
.RequestServices.GetRequiredService<ICompositeViewEngine>();
ViewExecutor.cs (3)
154
tempData = TempDataFactory.GetTempData(actionContext.
HttpContext
);
187
var response = viewContext.
HttpContext
.Response;
235
var viewDataValuesProvider = viewContext.
HttpContext
.Features.Get<IViewDataValuesProviderFeature>();
ViewResult.cs (1)
64
var executor = context.
HttpContext
.RequestServices.GetService<IActionResultExecutor<ViewResult>>();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (57)
ControllerUnitTestabilityTests.cs (2)
570
Assert.Null(controller.ControllerContext.
HttpContext
);
585
Assert.Equal(controllerContext.
HttpContext
, controller.HttpContext);
Filters\AutoValidateAntiforgeryTokenAuthorizationFilterTest.cs (3)
32
actionContext.
HttpContext
.Request.Method = httpMethod;
60
actionContext.
HttpContext
.Request.Method = httpMethod;
84
actionContext.
HttpContext
.Request.Method = "POST";
Filters\SaveTempDataFilterTest.cs (2)
385
return context.
HttpContext
.Response.WriteAsync($"Hello from {nameof(TestActionResult)}");
393
return context.
HttpContext
.Response.WriteAsync($"Hello from {nameof(TestKeepTempDataActionResult)}");
Filters\ValidateAntiforgeryTokenAuthorizationFilterTest.cs (3)
36
actionContext.
HttpContext
.Request.Method = httpMethod;
60
actionContext.
HttpContext
.Request.Method = "POST";
88
actionContext.
HttpContext
.Request.Method = "POST";
PartialViewResultExecutorTest.cs (2)
301
Assert.Equal("application/x-my-content-type", context.
HttpContext
.Response.ContentType);
330
Assert.Equal(404, context.
HttpContext
.Response.StatusCode);
RemoteAttributeBaseTest.cs (4)
223
var options = context.ActionContext.
HttpContext
.RequestServices
270
var options = context.ActionContext.
HttpContext
.RequestServices
315
var options = context.ActionContext.
HttpContext
.RequestServices
407
var options = context.ActionContext.
HttpContext
.RequestServices
RemoteAttributeTest.cs (1)
419
actionContext.
HttpContext
.RequestServices = serviceProvider;
Rendering\HtmlHelperFormTest.cs (16)
134
Assert.NotNull(htmlHelper.ViewContext.
HttpContext
);
135
var request = htmlHelper.ViewContext.
HttpContext
.Request;
184
Assert.NotNull(htmlHelper.ViewContext.
HttpContext
);
185
var request = htmlHelper.ViewContext.
HttpContext
.Request;
341
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
388
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
426
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
465
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
503
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
543
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
582
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
622
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
659
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
702
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
744
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
788
viewContext.
HttpContext
.RequestServices = serviceProvider.Object;
Rendering\ViewContextTests.cs (2)
69
Assert.Same(originalContext.
HttpContext
, context.
HttpContext
);
SkipStatusCodePagesAttributeTest.cs (1)
22
resourceExecutingContext.
HttpContext
.Features.Set<IStatusCodePagesFeature>(statusCodePagesFeature);
ViewComponentResultTest.cs (16)
152
var services = CreateServices(diagnosticListener: null, context: actionContext.
HttpContext
);
194
var body = ReadBody(actionContext.
HttpContext
.Response);
225
var body = ReadBody(actionContext.
HttpContext
.Response);
256
var body = ReadBody(actionContext.
HttpContext
.Response);
289
var body = ReadBody(actionContext.
HttpContext
.Response);
328
var body = ReadBody(actionContext.
HttpContext
.Response);
359
var body = ReadBody(actionContext.
HttpContext
.Response);
390
var body = ReadBody(actionContext.
HttpContext
.Response);
432
var body = ReadBody(actionContext.
HttpContext
.Response);
474
var body = ReadBody(actionContext.
HttpContext
.Response);
506
Assert.Equal(404, actionContext.
HttpContext
.Response.StatusCode);
568
var resultContentType = actionContext.
HttpContext
.Response.ContentType;
595
actionContext.
HttpContext
.Response.ContentType = "application/x-will-be-overridden";
609
Assert.Equal(expectedContentType, actionContext.
HttpContext
.Response.ContentType);
633
actionContext.
HttpContext
.Response.ContentType = expectedContentType;
646
Assert.Equal(expectedContentType, actionContext.
HttpContext
.Response.ContentType);
ViewComponents\HtmlContentViewComponentResultTest.cs (1)
46
new TempDataDictionary(actionContext.
HttpContext
, Mock.Of<ITempDataProvider>()),
ViewComponents\ViewViewComponentResultTest.cs (2)
365
viewComponentContext.ViewContext.
HttpContext
.RequestServices = serviceProvider.Object;
439
viewComponentContext.ViewContext.
HttpContext
.RequestServices = serviceProvider;
ViewResultExecutorTest.cs (2)
296
Assert.Equal("application/x-my-content-type", context.
HttpContext
.Response.ContentType);
320
Assert.Equal(404, context.
HttpContext
.Response.StatusCode);
Mvc.RoutingWebSite (7)
Controllers\ContactController.cs (2)
20
return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.
HttpContext
.Request.Scheme));
25
return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.
HttpContext
.Request.Scheme));
Controllers\LoginController.cs (2)
20
return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.
HttpContext
.Request.Scheme));
25
return _generator.Generate(Url.RouteUrl("ActionAsMethod", null, Url.ActionContext.
HttpContext
.Request.Scheme));
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (3)
27
var query = _actionContext.
HttpContext
.Request.Query;
43
actualUrl = _actionContext.
HttpContext
.Request.Path.Value,
56
var services = context.
HttpContext
.RequestServices;
RazorPagesWebSite (8)
CustomActionResult.cs (2)
12
context.
HttpContext
.Response.StatusCode = 200;
13
return context.
HttpContext
.Response.WriteAsync(nameof(CustomActionResult));
Pages\Filters\TestPageFilter.cs (1)
16
context.
HttpContext
.Response.Headers["PageFilterKey"] = "PageFilterValue";
Pages\Filters\TestPageModelFilter.cs (1)
16
context.
HttpContext
.Response.Headers["PageModelFilterKey"] = "PageModelFilterValue";
Pages\ShortCircuitPageAtAuthFilter.cshtml.cs (2)
29
if (ShouldShortCircuit(context.
HttpContext
, nameof(OnAuthorizationAsync)))
41
if (ShouldShortCircuit(context.
HttpContext
, nameof(OnAuthorization)))
Pages\ShortCircuitPageAtPageFilter.cshtml.cs (2)
36
if (ShouldShortCircuit(context.
HttpContext
, nameof(OnPageHandlerExecutionAsync)))
53
if (ShouldShortCircuit(context.
HttpContext
, nameof(OnPageHandlerExecuting)))
VersioningWebSite (3)
src\Mvc\test\WebSites\Common\TestResponseGenerator.cs (3)
27
var query = _actionContext.
HttpContext
.Request.Query;
43
actualUrl = _actionContext.
HttpContext
.Request.Path.Value,
56
var services = context.
HttpContext
.RequestServices;
XmlFormattersWebSite (2)
Controllers\XmlDataContractApiController.cs (1)
26
var mvcOptions = context.
HttpContext
.RequestServices.GetRequiredService<IOptions<MvcOptions>>();
Controllers\XmlSerializedApiController.cs (1)
26
var mvcOptions = context.
HttpContext
.RequestServices.GetRequiredService<IOptions<MvcOptions>>();