EncoderServiceCollectionExtensions.AddWebEncoders Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

AddWebEncoders(IServiceCollection)

Source:
EncoderServiceCollectionExtensions.cs
Source:
EncoderServiceCollectionExtensions.cs
Source:
EncoderServiceCollectionExtensions.cs

Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddWebEncoders(this Microsoft.Extensions.DependencyInjection.IServiceCollection services);

Parameters

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 10 (package-provided) and .NET Standard 2.0 (package-provided)
Product Versions
.NET 10 (package-provided)
.NET Standard 2.0 (package-provided)

AddWebEncoders(IServiceCollection, Action<WebEncoderOptions>)

Source:
EncoderServiceCollectionExtensions.cs
Source:
EncoderServiceCollectionExtensions.cs
Source:
EncoderServiceCollectionExtensions.cs

Adds HtmlEncoder, JavaScriptEncoder and UrlEncoder to the specified services.

C#
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddWebEncoders(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.Extensions.WebEncoders.WebEncoderOptions> setupAction);

Parameters

setupAction
Action<WebEncoderOptions>

An Action<T> to configure the provided WebEncoderOptions.

Returns

The IServiceCollection so that additional calls can be chained.

Applies to

.NET 10 (package-provided) and .NET Standard 2.0 (package-provided)
Product Versions
.NET 10 (package-provided)
.NET Standard 2.0 (package-provided)