StatusCodeOptions class

Options for configuring status code pages middleware.

public class StatusCodeOptions

Public Members

name description
StatusCodeOptions(…) Initializes a new instance of the StatusCodeOptions class.
BodyFormat { get; set; } Gets or sets the body format string for the status code response. Default is “Status Code: {0}”. The format string should contain a single placeholder for the status code.
ContentType { get; set; } Gets or sets the content type for the status code response. Default is “text/plain”.
Host { get; } Gets the KestrunHost instance associated with these options.
LanguageOptions { get; set; } Gets or sets the script options to execute for generating the status code response. If set, this script will be executed instead of using the BodyFormat.
LocationFormat { get; set; } Gets or sets the location format string for the status code response. If set, the middleware will issue a redirect to the specified location. The format string should contain a single placeholder for the status code. If both LocationFormat and PathFormat are set, LocationFormat takes precedence. If neither is set, no redirect will be issued.
Options { get; set; } Gets or sets the underlying StatusCodePagesOptions to configure the status code pages middleware.
PathFormat { get; set; } Gets or sets the path format string for the status code response. If set, the middleware will re-execute the request pipeline for the specified path. The format string should contain a single placeholder for the status code. If both LocationFormat and PathFormat are set, LocationFormat takes precedence. If neither is set, no re-execution will be performed.
QueryFormat { get; set; } Gets or sets the query format string for the status code response. If set, the middleware will append the specified query string to the path when re-executing the request pipeline. The format string should contain a single placeholder for the status code. This is only used if PathFormat is also set.

See Also