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