Table of Contents

Class ApplicationBuilderExtensions

Namespace
Cuemon.Extensions.AspNetCore.Hosting
Assembly
Cuemon.Extensions.AspNetCore.dll

Extension methods for the IApplicationBuilder interface.

public static class ApplicationBuilderExtensions
Inheritance
ApplicationBuilderExtensions

Examples

The following example demonstrates how to add the hosting environment HTTP header middleware to an ASP.NET Core application pipeline.

using Cuemon.AspNetCore.Hosting;
using Cuemon.Extensions.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;

namespace Examples;

public class StartupPipeline
{
    public void Configure(IApplicationBuilder app)
    {
        app.UseHostingEnvironment(o =>
        {
            o.HeaderName = "X-Environment";
        });

        app.UseRouting();
        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
        });

}
}

Methods

UseHostingEnvironment(IApplicationBuilder, Action<HostingEnvironmentOptions>)

Adds a hosting environment HTTP header to the IApplicationBuilder request execution pipeline.

public static IApplicationBuilder UseHostingEnvironment(this IApplicationBuilder builder, Action<HostingEnvironmentOptions> setup = null)

Parameters

builder IApplicationBuilder

The type that provides the mechanisms to configure an application’s request pipeline.

setup Action<HostingEnvironmentOptions>

The HostingEnvironmentOptions middleware which may be configured.

Returns

IApplicationBuilder

A reference to this instance after the operation has completed.

Remarks

Default HTTP header name is X-Hosting-Environment.