39 writes to HttpContext
Microsoft.AspNetCore.Rewrite (1)
RewriteMiddleware.cs (1)
58HttpContext = context,
Microsoft.AspNetCore.Rewrite.Tests (38)
IISUrlRewrite\InputParserTests.cs (2)
96var rewriteContext= new RewriteContext { HttpContext = new DefaultHttpContext(features), StaticFileProvider = null, Logger = NullLogger.Instance }; 162return new RewriteContext { HttpContext = context, StaticFileProvider = null, Logger = NullLogger.Instance };
IISUrlRewrite\ServerVariableTests.cs (2)
156return new RewriteContext { HttpContext = context ?? CreateTestHttpContext() }; 175var rewriteContext = new RewriteContext { HttpContext = context };
IISUrlRewrite\UrlRewriteApplicationTests.cs (3)
26var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 45var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 68var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\HeaderSegmentTests.cs (2)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 32var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\IsHttpsModSegmentTests.cs (1)
18var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\IsHttpsSegmentTests.cs (1)
18var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\IsIPV6SegmentTests.cs (3)
17var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 32var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 47var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\LocalAddressSegmentTests.cs (2)
17var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 30var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\LocalPortSegmentTests.cs (1)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\QueryStringSegmentTests.cs (1)
15var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\RemoteAddressSegmentTests.cs (2)
17var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 30var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\RemotePortSegmentTests.cs (1)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\RequestFilenameSegmentTests.cs (1)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\RequestMethodSegmentTests.cs (1)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\SchemeSegmentTests.cs (1)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\ServerNameSegmentTests.cs (2)
24var context = new RewriteContext { HttpContext = httpContext }; 25context.HttpContext = httpContext;
PatternSegments\ServerProtocolSegmentTests.cs (1)
17var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
PatternSegments\UrlSegmentTests.cs (2)
33var context = new RewriteContext { HttpContext = httpContext }; 34context.HttpContext = httpContext;
UrlActions\AbortActionTests.cs (1)
13var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlActions\ChangeCookieActionTests.cs (3)
16var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 37var context = new RewriteContext { HttpContext = new DefaultHttpContext() }; 53var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlActions\ForbiddenActionTests.cs (1)
15var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlActions\GoneActionTests.cs (1)
14var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlMatches\ExactMatchTests.cs (1)
18var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlMatches\IntegerMatchTests.cs (1)
30var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
UrlMatches\StringMatchTests.cs (1)
21var context = new RewriteContext { HttpContext = new DefaultHttpContext() };
71 references to HttpContext
Microsoft.AspNetCore.Rewrite (49)
ApacheModRewrite\ApacheModRewriteRule.cs (1)
24var initMatchRes = InitialMatch.Evaluate(context.HttpContext.Request.Path, context);
IISUrlRewrite\IISUrlRewriteRule.cs (1)
42var path = context.HttpContext.Request.Path;
PatternSegments\HeaderSegment.cs (1)
17return context.HttpContext.Request.Headers[_header];
PatternSegments\IISServerVariableSegment.cs (1)
21return context.HttpContext.GetServerVariable(_variableName) ?? _fallbackThunk().Evaluate(context, ruleBackReferences, conditionBackReferences);
PatternSegments\IsHttpsModSegment.cs (1)
12return context.HttpContext.Request.IsHttps ? "on" : "off";
PatternSegments\IsHttpsUrlSegment.cs (1)
12return context.HttpContext.Request.IsHttps ? "ON" : "OFF";
PatternSegments\IsIPV6Segment.cs (2)
12if (context.HttpContext.Connection.RemoteIpAddress == null) 16return context.HttpContext.Connection.RemoteIpAddress.AddressFamily == AddressFamily.InterNetworkV6 ? "on" : "off";
PatternSegments\LocalAddressSegment.cs (1)
10return context.HttpContext.Connection.LocalIpAddress?.ToString();
PatternSegments\LocalPortSegment.cs (1)
12return context.HttpContext.Connection.LocalPort.ToString(CultureInfo.InvariantCulture);
PatternSegments\QueryStringSegment.cs (1)
10var queryString = context.HttpContext.Request.QueryString.ToString();
PatternSegments\RemoteAddressSegment.cs (1)
10return context.HttpContext.Connection.RemoteIpAddress?.ToString();
PatternSegments\RemotePortSegment.cs (1)
12return context.HttpContext.Connection.RemotePort.ToString(CultureInfo.InvariantCulture);
PatternSegments\RequestFilenameSegment.cs (1)
10return context.HttpContext.Request.Path;
PatternSegments\RequestMethodSegment.cs (1)
10return context.HttpContext.Request.Method;
PatternSegments\SchemeSegment.cs (1)
10return context.HttpContext.Request.Scheme;
PatternSegments\ServerNameSegment.cs (1)
12return context.HttpContext.Request.Host.Host.ToString(CultureInfo.InvariantCulture);
PatternSegments\ServerProtocolSegment.cs (1)
12return context.HttpContext.Features.Get<IHttpRequestFeature>()?.Protocol;
PatternSegments\UrlSegment.cs (2)
25return _uriMatchPart == UriMatchPart.Full ? context.HttpContext.Request.GetEncodedUrl() : (string)context.HttpContext.Request.Path;
RedirectRule.cs (2)
29var request = context.HttpContext.Request; 46var response = context.HttpContext.Response;
RedirectToHttpsRule.cs (4)
17if (!context.HttpContext.Request.IsHttps) 19var host = context.HttpContext.Request.Host; 32var req = context.HttpContext.Request; 34var response = context.HttpContext.Response;
RedirectToNonWwwRule.cs (1)
36var request = context.HttpContext.Request;
RedirectToWwwHelper.cs (2)
44var request = context.HttpContext.Request; 45var response = context.HttpContext.Response;
RedirectToWwwRule.cs (2)
36var req = context.HttpContext.Request; 54new HostString($"www.{context.HttpContext.Request.Host.Value}"),
RewriteContext.cs (1)
18/// Gets and sets the <see cref="HttpContext"/>
RewriteRule.cs (2)
29var path = context.HttpContext.Request.Path; 43var request = context.HttpContext.Request;
UrlActions\AbortAction.cs (3)
12context.HttpContext.Abort(); 14context.Logger.AbortedRequest(context.HttpContext.Request.Path + context.HttpContext.Request.QueryString);
UrlActions\ChangeCookieAction.cs (1)
38context.HttpContext.Response.Cookies.Append(Name, Value ?? string.Empty, options);
UrlActions\CustomResponseAction.cs (4)
24var response = context.HttpContext.Response; 29context.HttpContext.Features.GetRequiredFeature<IHttpResponseFeature>().ReasonPhrase = StatusReason; 34var feature = context.HttpContext.Features.Get<IHttpBodyControlFeature>(); 47context.Logger.CustomResponse(context.HttpContext.Request.GetEncodedUrl());
UrlActions\ForbiddenAction.cs (1)
12context.HttpContext.Response.StatusCode = StatusCodes.Status403Forbidden;
UrlActions\GoneAction.cs (1)
12context.HttpContext.Response.StatusCode = StatusCodes.Status410Gone;
UrlActions\RedirectAction.cs (4)
32var response = context.HttpContext.Response; 33var pathBase = context.HttpContext.Request.PathBase; 59var query = context.HttpContext.Request.QueryString.Add( 76response.Headers.Location = pathBase + pattern + context.HttpContext.Request.QueryString;
UrlActions\RewriteAction.cs (1)
48var request = context.HttpContext.Request;
Microsoft.AspNetCore.Rewrite.Tests (22)
PatternSegments\HeaderSegmentTests.cs (1)
18context.HttpContext.Request.Headers.Location = "foo";
PatternSegments\IsHttpsModSegmentTests.cs (1)
19context.HttpContext.Request.Scheme = input;
PatternSegments\IsHttpsSegmentTests.cs (1)
19context.HttpContext.Request.Scheme = input;
PatternSegments\IsIPV6SegmentTests.cs (3)
18context.HttpContext.Connection.RemoteIpAddress = null; 33context.HttpContext.Connection.RemoteIpAddress = IPAddress.Parse("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); 48context.HttpContext.Connection.RemoteIpAddress = IPAddress.Parse("20.30.40.50");
PatternSegments\LocalAddressSegmentTests.cs (2)
18context.HttpContext.Connection.LocalIpAddress = IPAddress.Parse("20.30.40.50"); 31context.HttpContext.Connection.LocalIpAddress = null;
PatternSegments\LocalPortSegmentTests.cs (1)
17context.HttpContext.Connection.LocalPort = 800;
PatternSegments\QueryStringSegmentTests.cs (1)
16context.HttpContext.Request.QueryString = new QueryString("?hey=1");
PatternSegments\RemoteAddressSegmentTests.cs (2)
18context.HttpContext.Connection.RemoteIpAddress = IPAddress.Parse("20.30.40.50"); 31context.HttpContext.Connection.RemoteIpAddress = null;
PatternSegments\RemotePortSegmentTests.cs (1)
17context.HttpContext.Connection.RemotePort = 800;
PatternSegments\RequestFilenameSegmentTests.cs (1)
17context.HttpContext.Request.Path = new PathString("/foo/bar");
PatternSegments\RequestMethodSegmentTests.cs (1)
17context.HttpContext.Request.Method = HttpMethods.Get;
PatternSegments\SchemeSegmentTests.cs (1)
17context.HttpContext.Request.Scheme = "http";
PatternSegments\ServerProtocolSegmentTests.cs (1)
18context.HttpContext.Features.Set<IHttpRequestFeature>(new HttpRequestFeature { Protocol = "http" });
UrlActions\ChangeCookieActionTests.cs (3)
29var cookieHeaders = context.HttpContext.Response.Headers.SetCookie; 45var cookieHeaders = context.HttpContext.Response.Headers.SetCookie; 58var cookieHeaders = context.HttpContext.Response.Headers.SetCookie;
UrlActions\ForbiddenActionTests.cs (1)
21Assert.Equal(StatusCodes.Status403Forbidden, context.HttpContext.Response.StatusCode);
UrlActions\GoneActionTests.cs (1)
20Assert.Equal(StatusCodes.Status410Gone, context.HttpContext.Response.StatusCode);