KestrunHostMapExtensions.AddStaticMapOverride method (1 of 4)

Adds a static override route to the KestrunHost using the specified MapRouteOptions. This allows you to override static file serving with dynamic content. Call this method before adding static file components to ensure it takes precedence.

public static KestrunHost AddStaticMapOverride(this KestrunHost host, MapRouteOptions options)
parameter description
host The KestrunHost instance.
options The MapRouteOptions containing route configuration.

Return Value

The KestrunHost instance for method chaining.

See Also


KestrunHostMapExtensions.AddStaticMapOverride method (2 of 4)

Adds a static override route to the KestrunHost using the specified MapRouteOptions and handler. This allows you to override static file serving with dynamic content by providing a handler that will be executed for the specified route pattern.

public static KestrunHost AddStaticMapOverride(this KestrunHost host, MapRouteOptions options, 
    KestrunHandler handler)
parameter description
host The KestrunHost instance.
options The MapRouteOptions containing route configuration.
handler The handler to execute for the route.

Return Value

The KestrunHost instance for method chaining.

See Also


KestrunHostMapExtensions.AddStaticMapOverride method (3 of 4)

Adds a static override route to the KestrunHost for the specified pattern and handler. This allows you to override static file serving with dynamic content. Call this method before adding static file components to ensure it takes precedence.

public static KestrunHost AddStaticMapOverride(this KestrunHost host, string pattern, 
    KestrunHandler handler, string[]? requireSchemes = null)
parameter description
host The KestrunHost instance.
pattern The route pattern to match.
handler The handler to execute for the route.
requireSchemes Optional array of authorization schemes required for the route.

Return Value

The KestrunHost instance for method chaining.

Remarks

This method allows you to override static file serving with dynamic content by providing a handler that will be executed for the specified route pattern.

See Also


KestrunHostMapExtensions.AddStaticMapOverride method (4 of 4)

Adds a static override route to the KestrunHost for the specified pattern and script code. This allows you to override static file serving with dynamic content. /// Call this method before adding static file components to ensure it takes precedence.

public static KestrunHost AddStaticMapOverride(this KestrunHost host, string pattern, string code, 
    ScriptLanguage language = ScriptLanguage.PowerShell, string[]? requireSchemes = null, 
    Dictionary<string, object?>? arguments = null)
parameter description
host The KestrunHost instance.
pattern The route pattern to match.
code The script code to execute.
language The scripting language to use.
requireSchemes Optional array of authorization schemes required for the route.
arguments Optional dictionary of arguments to pass to the script.

Return Value

The KestrunHost instance for method chaining.

Remarks

This method allows you to override static file serving with dynamic content by providing a script that will be executed for the specified route pattern.

See Also