1 override of Host
Microsoft.AspNetCore.Http (1)
Internal\DefaultHttpRequest.cs (1)
115public override HostString Host
55 writes to Host
HttpAbstractions.SampleApp (1)
Program.cs (1)
16request.Host = new HostString("Host:port");
Microsoft.AspNetCore.Components.Endpoints.Tests (4)
EndpointHtmlRendererTest.cs (3)
759ctx.Request.Host = new HostString("localhost"); 790ctx.Request.Host = new HostString("localhost"); 1658context.Request.Host = new HostString("localhost");
RazorComponentResultTest.cs (1)
473result.Request.Host = new HostString("test");
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (2)
Infrastructure\TestHelpers.cs (1)
27httpContext.Request.Host = new HostString("localhost");
JsonTranscodingServerCallContextTests.cs (1)
64httpContext.Request.Host = new HostString("localhost");
Microsoft.AspNetCore.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (5)
243c.Request.Host = new HostString("localhost"); 302c.Request.Host = new HostString("localhost"); 362c.Request.Host = new HostString("localhost"); 417c.Request.Host = new HostString("localhost"); 1052c.Request.Host = new HostString("localhost");
Microsoft.AspNetCore.Http.Extensions.Tests (2)
UriHelperTests.cs (2)
88request.Host = new HostString("my.HoΨst:80"); 103request.Host = new HostString("my.HoΨst:80");
Microsoft.AspNetCore.Http.Tests (5)
ApplicationBuilderTests.cs (1)
93httpContext.Request.Host = new HostString("localhost:5000");
Internal\DefaultHttpRequestTests.cs (4)
112request.Host = new HostString("löcalhöst"); 304context.Request.Host = new HostString("localhost", 8080); 318context.Request.Host = new HostString("localhost"); 332context.Request.Host = new HostString("localhost", 8080);
Microsoft.AspNetCore.HttpOverrides (1)
ForwardedHeadersMiddleware.cs (1)
360request.Host = HostString.FromUriComponent(currentValues.Host);
Microsoft.AspNetCore.Mvc.Core.Test (12)
RequireHttpsAttributeTests.cs (2)
73requestContext.Request.Host = HostString.FromUriComponent(host); 175requestContext.Request.Host = HostString.FromUriComponent(uri);
Routing\ControllerLinkGeneratorExtensionsTest.cs (1)
178httpContext.Request.Host = new HostString("example.com");
Routing\PageLinkGeneratorExtensionsTest.cs (1)
148httpContext.Request.Host = new HostString("example.com");
Routing\UrlHelperBaseTest.cs (1)
126context.Request.Host = new HostString(host);
Routing\UrlHelperExtensionsTest.cs (6)
614Host = new HostString(expectedHost), 649Host = new HostString(expectedHost), 684Host = new HostString("www.asp.net"), 722Host = new HostString(expectedHost), 770Host = new HostString(expectedHost), 818Host = new HostString("www.asp.net"),
Routing\UrlHelperTestBase.cs (1)
1153context.Request.Host = new HostString(host);
Microsoft.AspNetCore.OutputCaching.Tests (3)
OutputCacheKeyProviderTests.cs (3)
23context.HttpContext.Request.Host = new HostString("example.com", 80); 40context.HttpContext.Request.Host = new HostString("example.com", 80); 301context.HttpContext.Request.Host = new HostString("example.com" + KeyDelimiter, 80);
Microsoft.AspNetCore.Rewrite (2)
RewriteRule.cs (1)
64request.Host = host;
UrlActions\RewriteAction.cs (1)
87request.Host = host;
Microsoft.AspNetCore.Rewrite.Tests (3)
IISUrlRewrite\ServerVariableTests.cs (1)
140context.Request.Host = new HostString("example.com");
PatternSegments\ServerNameSegmentTests.cs (1)
21httpContext.Request.Host = new HostString(host, port);
PatternSegments\UrlSegmentTests.cs (1)
30httpContext.Request.Host = new HostString(host, port);
Microsoft.AspNetCore.Routing.Tests (10)
DefaultLinkGeneratorTest.cs (6)
140httpContext.Request.Host = new HostString("example.com"); 273httpContext.Request.Host = new HostString("example.com"); 415httpContext.Request.Host = new HostString("example.com"); 440httpContext.Request.Host = new HostString("example.com"); 464httpContext.Request.Host = new HostString("example.com"); 511httpContext.Request.Host = new HostString("example.com");
LinkGeneratorEndpointNameExtensionsTest.cs (1)
129httpContext.Request.Host = new HostString("example.com");
LinkGeneratorRouteValuesAddressExtensionsTest.cs (2)
151httpContext.Request.Host = new HostString("example.com"); 183httpContext.Request.Host = new HostString("example.com");
Matching\HostMatcherPolicyIntegrationTestBase.cs (1)
392httpContext.Request.Host = new HostString(host);
Microsoft.AspNetCore.TestHost (5)
ClientHandler.cs (2)
173req.Host = HostString.FromUriComponent(request.RequestUri); 176req.Host = new HostString(req.Host.Host);
TestServer.cs (2)
216request.Host = HostString.FromUriComponent(BaseAddress); 219request.Host = new HostString(request.Host.Host);
WebSocketClient.cs (1)
67request.Host = uri.IsDefaultPort
115 references to Host
AutobahnTestApp (2)
Startup.cs (2)
32var wsUrl = $"{wsScheme}://{context.Request.Host.Host}:{context.Request.Host.Port}{context.Request.Path}";
BasicWebSite (1)
StartupWithoutEndpointRouting.cs (1)
67client.BaseAddress = new Uri($"{httpContext.Request.Scheme}://{httpContext.Request.Host}");
Certificate.Optional.Sample (2)
Startup.cs (2)
49return context.Response.WriteAsync($"Hello {context.User.Identity.Name} at {context.Request.Host}"); 54return context.Response.WriteAsync($"Hello {context.User.Identity.Name} at {context.Request.Host}. Try /auth");
HeaderPropagationSample (1)
Startup.cs (1)
75var uri = UriHelper.BuildAbsolute(context.Request.Scheme, context.Request.Host, context.Request.PathBase, "/forwarded");
HostFilteringSample (1)
Startup.cs (1)
46return context.Response.WriteAsync("Hello World! " + context.Request.Host);
Identity.DefaultUI.WebSite (1)
Services\ContosoAuthenticationHandler.cs (1)
27var uri = $"{Request.Scheme}://{Request.Host}{Request.PathBase}{Options.RemoteLoginPath}";
InMemory.FunctionalTests (5)
Http2\Http2TestBase.cs (1)
195_receivedRequestFields.Authority = context.Request.Host.Value;
Http2\Http2WebSocketTests.cs (3)
29Assert.Equal("server.example.com", context.Request.Host.Value); 91Assert.Equal("server.example.com", context.Request.Host.Value); 167Assert.Equal("server.example.com", context.Request.Host.Value);
Http3\Http3ConnectionTests.cs (1)
427authority = context.Request.Host.Value;
Interop.FunctionalTests (3)
Http3\Http3RequestTests.cs (1)
329authority = context.Request.Host.Value;
HttpClientHttp2InteropTests.cs (2)
1558Assert.Equal("點.看", context.Request.Host.Host); 1559return context.Response.WriteAsync(context.Request.Host.Host);
Microsoft.AspNetCore.Authentication (2)
AuthenticationHandler.cs (2)
106get => Request.Scheme + Uri.SchemeDelimiter + Request.Host + Request.PathBase + Request.Path + Request.QueryString; 197=> Request.Scheme + Uri.SchemeDelimiter + Request.Host + OriginalPathBase + targetPath;
Microsoft.AspNetCore.Components.Endpoints (3)
Rendering\EndpointHtmlRenderer.cs (2)
207request.Host, 215var result = UriHelper.BuildAbsolute(request.Scheme, request.Host, request.PathBase);
Rendering\EndpointHtmlRenderer.Prerendering.cs (1)
235|| absoluteUri.Authority != request.Host.Value;
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (5)
HealthCheckMiddlewareTests.cs (5)
713context.Connection.LocalPort = context.Request.Host.Port.Value; 751context.Connection.LocalPort = context.Request.Host.Port.Value; 789context.Connection.LocalPort = context.Request.Host.Port.Value; 825context.Connection.LocalPort = context.Request.Host.Port.Value; 869context.Connection.LocalPort = context.Request.Host.Port.Value;
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Logging\HttpLoggingRedactionInterceptor.cs (1)
81logContext.AddParameter(HttpLoggingTagNames.Host, context.Request.Host.Value);
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\JsonTranscodingServerCallContext.cs (1)
64protected override string HostCore => HttpContext.Request.Host.Value ?? string.Empty;
Microsoft.AspNetCore.Hosting (10)
Internal\HostingApplicationDiagnostics.cs (1)
446[DynamicDependency(nameof(HttpRequest.Host), typeof(HttpRequest))]
Internal\HostingRequestFinishedLog.cs (3)
427 => new KeyValuePair<string, object?>(nameof(request.Host), request.Host.Value), 66_cachedToString = $"Request finished {request.Protocol} {request.Method} {request.Scheme}://{request.Host.Value}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value} - {response.StatusCode.ToString(CultureInfo.InvariantCulture)} {ValueOrEmptyMarker(response.ContentLength)} {EscapedValueOrEmptyMarker(response.ContentType)} {Elapsed.TotalMilliseconds.ToString("0.0000", CultureInfo.InvariantCulture)}ms";
Internal\HostingRequestStartingLog.cs (3)
305 => new KeyValuePair<string, object?>(nameof(_request.Host), _request.Host.Value), 48_cachedToString = $"Request starting {request.Protocol} {request.Method} {request.Scheme}://{request.Host.Value}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value} - {EscapedValueOrEmptyMarker(request.ContentType)} {ValueOrEmptyMarker(request.ContentLength)}";
Internal\HostingRequestUnhandledLog.cs (3)
252 => new KeyValuePair<string, object?>(nameof(_httpContext.Request.Host), _httpContext.Request.Host), 44_cachedToString = $"Request reached the end of the middleware pipeline without being handled by application code. Request path: {request.Method} {request.Scheme}://{request.Host}{request.PathBase}{request.Path}, Response status code: {response.StatusCode}";
Microsoft.AspNetCore.Hosting.Tests (1)
Internal\HostingRequestStartLogTests.cs (1)
20mockRequest.Setup(request => request.Host).Returns(new HostString(input));
Microsoft.AspNetCore.Http (2)
src\Shared\Debugger\HttpContextDebugFormatter.cs (2)
93!request.Host.HasValue && 108var host = request.Host.Value;
Microsoft.AspNetCore.Http.Extensions (2)
UriHelper.cs (2)
186return BuildAbsolute(request.Scheme, request.Host, request.PathBase, request.Path, request.QueryString); 208var host = request.Host.Value ?? string.Empty;
Microsoft.AspNetCore.Http.Tests (2)
Internal\DefaultHttpRequestTests.cs (2)
75var host = request.Host; 95var host = request.Host;
Microsoft.AspNetCore.HttpOverrides (1)
ForwardedHeadersMiddleware.cs (1)
348requestHeaders[_options.OriginalHostHeaderName] = request.Host.ToString();
Microsoft.AspNetCore.HttpOverrides.Tests (6)
ForwardedHeadersMiddlewareTest.cs (6)
309Assert.Equal("testhost", context.Request.Host.ToString()); 365Assert.Equal(hostHeader, context.Request.Host.ToString()); 450Assert.NotEqual(hostHeader, context.Request.Host.Value); 925Assert.Equal("testhost", context.Request.Host.ToString()); 960Assert.Equal("localhost", context.Request.Host.ToString()); 993Assert.Equal("localhost", context.Request.Host.ToString());
Microsoft.AspNetCore.HttpsPolicy (3)
HstsMiddleware.cs (2)
70if (IsHostExcluded(context.Request.Host.Host)) 72_logger.SkippingExcludedHost(context.Request.Host.Host);
HttpsRedirectionMiddleware.cs (1)
91var host = context.Request.Host;
Microsoft.AspNetCore.Mvc.Abstractions (1)
IUrlHelper.cs (1)
103/// This method uses the value of <see cref="HttpRequest.Host"/> to populate the host section of the generated URI.
Microsoft.AspNetCore.Mvc.Core (13)
AcceptedAtActionResult.cs (1)
83request.Host.ToUriComponent());
CreatedAtActionResult.cs (1)
83request.Host.ToUriComponent());
RequireHttpsAttribute.cs (1)
76var host = request.Host;
Routing\ControllerLinkGeneratorExtensions.cs (1)
114/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used.
Routing\PageLinkGeneratorExtensions.cs (1)
115/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used.
Routing\UrlHelperBase.cs (3)
61Host = ActionContext.HttpContext.Request.Host.ToUriComponent() 149host = string.IsNullOrEmpty(host) ? ActionContext.HttpContext.Request.Host.Value : host; 211host = string.IsNullOrEmpty(host) ? ActionContext.HttpContext.Request.Host.Value : host;
UrlHelperExtensions.cs (5)
106/// This method uses the value of <see cref="HttpRequest.Host"/> to populate the host section of the generated URI. 257/// This method uses the value of <see cref="HttpRequest.Host"/> to populate the host section of the generated URI. 405/// This method uses the value of <see cref="HttpRequest.Host"/> to populate the host section of the generated URI. 534host = httpContext.Request.Host.ToUriComponent(); 583host = httpContext.Request.Host.ToUriComponent();
Microsoft.AspNetCore.ResponseCaching (1)
ResponseCachingKeyProvider.cs (1)
51.AppendUpperInvariant(request.Host.Value);
Microsoft.AspNetCore.Rewrite (10)
PatternSegments\ServerNameSegment.cs (1)
12return context.HttpContext.Request.Host.Host.ToString(CultureInfo.InvariantCulture);
RedirectToHttpsRule.cs (1)
19var host = context.HttpContext.Request.Host;
RedirectToNonWwwRule.cs (3)
46if (!request.Host.HasValue || !request.Host.Value.StartsWith(WwwDot, StringComparison.OrdinalIgnoreCase)) 54new HostString(request.Host.Value.Substring(4)), // We verified the hostname begins with "www." already.
RedirectToWwwHelper.cs (2)
15if (request.Host.Host.Equals(Localhost, StringComparison.OrdinalIgnoreCase)) 26if (domain.Equals(request.Host.Host, StringComparison.OrdinalIgnoreCase))
RedirectToWwwRule.cs (3)
46if (req.Host.HasValue && req.Host.Value.StartsWith(WwwDot, StringComparison.OrdinalIgnoreCase)) 54new HostString($"www.{context.HttpContext.Request.Host.Value}"),
Microsoft.AspNetCore.Rewrite.Tests (17)
ApacheModRewrite\ModRewriteMiddlewareTest.cs (4)
289app.Run(context => context.Response.WriteAsync(context.Request.Scheme + "://" + context.Request.Host.Host + context.Request.Path + context.Request.QueryString)); 315app.Run(context => context.Response.WriteAsync(context.Request.Scheme + "://" + context.Request.Host.Host + context.Request.Path + context.Request.QueryString)); 342app.Run(context => context.Response.WriteAsync(context.Request.Scheme + "://" + context.Request.Host.Host + context.Request.Path + context.Request.QueryString)); 370app.Run(context => context.Response.WriteAsync(context.Request.Scheme + "://" + context.Request.Host.Host + context.Request.Path + context.Request.QueryString));
IISUrlRewrite\MiddleWareTests.cs (3)
279context.Request.Host + 316context.Request.Host + 353context.Request.Host +
MiddlewareTests.cs (10)
31context.Request.Host + 61context.Request.Host + 93context.Request.Host + 125context.Request.Host + 863context.Request.Host + 901context.Request.Host + 937context.Request.Host + 974context.Request.Host + 1011context.Request.Host + 1044context.Request.Host +
Microsoft.AspNetCore.Routing (6)
DefaultLinkGenerator.cs (1)
143host ?? httpContext.Request.Host,
LinkGeneratorEndpointNameAddressExtensions.cs (2)
162/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used. 221/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used.
LinkGeneratorRouteValuesAddressExtensions.cs (2)
162/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used. 221/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used.
Matching\HostMatcherPolicy.cs (1)
335var hostString = httpContext.Request.Host;
Microsoft.AspNetCore.Routing.Abstractions (1)
LinkGenerator.cs (1)
88/// The URI host/authority, applied to the resulting URI. Optional. If not provided, the value <see cref="HttpRequest.Host"/> will be used.
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Startup.cs (1)
126url = $"{context.Request.Scheme}://{context.Request.Host}/authorizedHub",
Microsoft.AspNetCore.StaticFiles (1)
Helpers.cs (1)
45var redirect = UriHelper.BuildAbsolute(request.Scheme, request.Host, request.PathBase, request.Path + "/", request.QueryString);
Microsoft.AspNetCore.TestHost (4)
ClientHandler.cs (2)
170if (!req.Host.HasValue) 176req.Host = new HostString(req.Host.Host);
TestServer.cs (1)
219request.Host = new HostString(request.Host.Host);
WebSocketClient.cs (1)
65if (!request.Host.HasValue)
Microsoft.AspNetCore.TestHost.Tests (3)
ClientHandlerTests.cs (1)
62Assert.Equal("example.com", context.Request.Host.Value);
HttpContextBuilderTests.cs (1)
34Assert.Equal("example.com", context.Request.Host.Value);
WebSocketClientTests.cs (1)
30capturedHost = ctx.Request.Host.Value;
QueueSharing (1)
Program.cs (1)
67await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now);
SelfHostServer (1)
Startup.cs (1)
31await context.Response.WriteAsync("Hello world from " + context.Request.Host + " at " + DateTime.Now);