Skip to main content
A newer version of this page is available. .

DevExpressWasmMasksApplicationBuilderExtensions.UseDevExpressBlazorWasmMasksStaticFiles(IApplicationBuilder) Method

Enables serving static files for client-side masks in Blazor Server applications.

Namespace: Microsoft.Extensions.DependencyInjection

Assembly: DevExpress.Blazor.Server.WebAssembly.v21.2.dll

NuGet Package: DevExpress.Blazor.Server.WebAssembly

Declaration

public static IApplicationBuilder UseDevExpressBlazorWasmMasksStaticFiles(
    this IApplicationBuilder builder
)

Parameters

Name Type Description
builder IApplicationBuilder

An object that defines the mechanisms to configure an application’s request pipeline.

Returns

Type Description
IApplicationBuilder

An object that defines the mechanisms to configure an application’s request pipeline.

Remarks

The UseDevExpressBlazorWasmMasksStaticFiles method registers DevExpress Blazor middleware for client-side (WebAssembly) masks in your Blazor Server application. In this mode, data editors with masks process input text on the client to reduce input delays when you have a slow connection. For more information on the mode, refer to the following section: Optimize Mask Performance in Blazor Server Apps.

To activate this functionality, follow the steps below:

.NET 5.0

  1. Install the DevExpress.Blazor.Server.WebAssembly NuGet Package.
  2. Register the middleware. Call the UseDevExpressBlazorWasmMasksStaticFiles method from the Startup.cs file’s Configure method:

    using Microsoft.AspNetCore.Builder;
    using Microsoft.Extensions.DependencyInjection;
    
    public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
        // ...
        app.UseStaticFiles();
        app.UseDevExpressBlazorWasmMasksStaticFiles();
        // ...
    }
    
  3. Set up mask-related options. Call the AddDevExpressBlazorWasmMasks(IServiceCollection) method from the Startup.cs file’s ConfigureServices method:

    using Microsoft.Extensions.DependencyInjection;
    
    public void ConfigureServices(IServiceCollection services) {
        // ...
        services.AddDevExpressBlazor();
        services.AddDevExpressBlazorWasmMasks();
    }
    

.NET 6.0

  1. Install the DevExpress.Blazor.Server.WebAssembly NuGet Package.
  2. Register the middleware. Call the UseDevExpressBlazorWasmMasksStaticFiles method in the Program.cs file:

    app.UseDevExpressBlazorWasmMasksStaticFiles();
    
  3. Set up mask-related options. Call the AddDevExpressBlazorWasmMasks(IServiceCollection) method in the Program.cs file:

    builder.Services.AddDevExpressBlazorWasmMasks();
    

Note

The described approach does not work correctly if you use additional application settings that interfere with our middleware (for example, authorization and so on). In such cases, you should enable serving static files in your application. For example, if your application requires authorization, use an approach from the following Microsoft article: Static Files - Non-Standard Content Types.

See Also