Class HostNameFilteringExtensions
Contains extension methods for registering the HostNameFilteringMiddleware in an application's service collection. These methods provide a convenient way to configure and apply hostname-based request filtering directly from the application startup.
Inherited Members
Namespace: Coree.NETASP.Middleware.HostNameFiltering
Assembly: Coree.NETASP.dll
Syntax
public static class HostNameFilteringExtensions
Methods
| Edit this page View SourceAddHostNameFiltering(IServiceCollection, string[]?, string[]?, bool, int, int)
Adds and configures the HostNameFilteringMiddleware options.
Declaration
public static IServiceCollection AddHostNameFiltering(this IServiceCollection services, string[]? whitelist = null, string[]? blacklist = null, bool continueOnDisallowed = false, int disallowedFailureRating = 10, int disallowedStatusCode = 400)
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | services | The IServiceCollection to add services to. This collection will be enhanced by the configuration of the HostNameFilteringMiddleware. |
string[] | whitelist | An array of strings specifying the hostnames that should be allowed by the middleware. This list directly populates the Whitelist property of the HostNameFilterOptions. |
string[] | blacklist | |
bool | continueOnDisallowed | |
int | disallowedFailureRating | |
int | disallowedStatusCode |
Returns
Type | Description |
---|---|
IServiceCollection | The IServiceCollection so that additional calls can be chained, enabling fluent configuration. |