int Order { get; }
Source
Gets the filter order. The value runs after normal MVC result filters while still leaving a small buffer for application filters that intentionally need to run later.
Defines stable hidden field names used by RazorWire-enhanced form submissions.
Detects whether an incoming request originated from a RazorWire-enhanced form.
ValueTask<bool> IsRazorWireFormRequestAsync(HttpRequest request, CancellationToken cancellationToken = default)
Determines whether a request carries RazorWire form markers.
request
cancellationToken
true
when the request has the RazorWire form header, an already-parsed marker field, or a safely readable URL-encoded marker field; otherwise false
.
Defines stable event identifiers for RazorWire form-related logs.
Normalizes form failure targets that can be addressed safely by server-generated Turbo Streams.
bool TryNormalizeIdTarget(string? failureTarget, out string normalized)
Attempts to normalize a simple element-id target for a failed RazorWire form.
failureTarget
data-rw-form-failure-target
. A leading #
is accepted and removed. normalized
true
, contains the id without a leading #
.
true
when failureTarget
is a non-empty element id; otherwise false
. CSS selector-like values that start with .
or [
, and values containing whitespace, are rejected because server-generated Turbo Stream target
attributes address one element id rather than arbitrary selectors.
Defines stable HTTP header names used by RazorWire-enhanced form submissions.
Converts RazorWire form anti-forgery validation failures into negotiated responses and preserves local fallback.
The filter runs late in MVC result execution so it can see IAntiforgeryValidationFailedResult
results produced by MVC anti-forgery validation. It only rewrites requests classified as RazorWire forms, sets RazorWireFormHeaders.FormHandled
, and chooses Turbo Stream, HTML, or plain-text output from the request's Accept
header. Turbo Stream responses prefer a form-local target when the posted marker can be read within the configured safety limit; otherwise they append one safe diagnostic block to body
. Correlated Turbo responses echo request metadata so a delayed form-local failure cannot update a newer dialog flow. Invalid presentation metadata returns the same 400 diagnostic as plain text without applying stream actions, with RazorWireFormHeaders.FormHandled
false so the current form can present local failure/retry UI.
Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
Rewrites RazorWire anti-forgery validation failures into form responses, then continues result execution. Invalid presentation metadata uses an unhandled plaintext response so the current form can show local retry UI.
context
next
A task that completes when the result pipeline has continued.
int Order { get; }
Source
Gets the filter order. The value runs after normal MVC result filters while still leaving a small buffer for application filters that intentionally need to run later.