Back to Practical Aspnetcore

HX-Refresh Response Header

projects/htmx/header-hx-refresh/README.md

latest530 B
Original Source

HX-Refresh Response Header

This example demonstrates the usage of HX-Refresh response header to instruct the web browser to refresh the page (doc).

We are using the nice utilities provided by the excellent Htmx package.

csharp
htmx.MapGet("/", (HttpRequest request, HttpResponse response) =>
{
    response.Htmx(x =>
    {
        x.Refresh();
    });

    return Results.Content($"GET => {DateTime.UtcNow}");
});