Results.Text Method

Definition

Overloads

Text(ReadOnlySpan<Byte>, String, Nullable<Int32>)

Writes the utf8Content UTF-8 encoded text to the HTTP response.

Text(String, String, Encoding)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding).

Text(String, String, Encoding, Nullable<Int32>)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding, Nullable<Int32>).

Text(ReadOnlySpan<Byte>, String, Nullable<Int32>)

Writes the utf8Content UTF-8 encoded text to the HTTP response.

public static Microsoft.AspNetCore.Http.IResult Text (ReadOnlySpan<byte> utf8Content, string? contentType = default, int? statusCode = default);
static member Text : ReadOnlySpan<byte> * string * Nullable<int> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (utf8Content As ReadOnlySpan(Of Byte), Optional contentType As String = Nothing, Optional statusCode As Nullable(Of Integer) = Nothing) As IResult

Parameters

utf8Content
ReadOnlySpan<Byte>

The content to write to the response.

contentType
String

The content type (MIME type).

statusCode
Nullable<Int32>

The status code to return.

Returns

The created IResult object for the response.

Applies to

Text(String, String, Encoding)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding).

public static Microsoft.AspNetCore.Http.IResult Text (string content, string? contentType = default, System.Text.Encoding? contentEncoding = default);
public static Microsoft.AspNetCore.Http.IResult Text (string? content, string? contentType, System.Text.Encoding? contentEncoding);
static member Text : string * string * System.Text.Encoding -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (content As String, Optional contentType As String = Nothing, Optional contentEncoding As Encoding = Nothing) As IResult
Public Shared Function Text (content As String, contentType As String, contentEncoding As Encoding) As IResult

Parameters

content
String

The content to write to the response.

contentType
String

The content type (MIME type).

contentEncoding
Encoding

The content encoding.

Returns

The created IResult object for the response.

Remarks

If encoding is provided by both the 'charset' and the contentEncoding parameters, then the contentEncoding parameter is chosen as the final encoding.

Applies to

Text(String, String, Encoding, Nullable<Int32>)

Writes the content string to the HTTP response.

This is an alias for Content(String, String, Encoding, Nullable<Int32>).

public static Microsoft.AspNetCore.Http.IResult Text (string? content, string? contentType = default, System.Text.Encoding? contentEncoding = default, int? statusCode = default);
static member Text : string * string * System.Text.Encoding * Nullable<int> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Text (content As String, Optional contentType As String = Nothing, Optional contentEncoding As Encoding = Nothing, Optional statusCode As Nullable(Of Integer) = Nothing) As IResult

Parameters

content
String

The content to write to the response.

contentType
String

The content type (MIME type).

contentEncoding
Encoding

The content encoding.

statusCode
Nullable<Int32>

The status code to return.

Returns

The created IResult object for the response.

Remarks

If encoding is provided by both the 'charset' and the contentEncoding parameters, then the contentEncoding parameter is chosen as the final encoding.

Applies to