Share via


Results.Content Method

Definition

Overloads

Content(String, String, Encoding)

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding).

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

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding, Nullable<Int32>).

Content(String, MediaTypeHeaderValue)

Writes the content string to the HTTP response.

Content(String, String, Encoding)

Source:
Results.cs

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding).

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

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

Source:
Results.cs

Writes the content string to the HTTP response.

This is equivalent to Text(String, String, Encoding, Nullable<Int32>).

public static Microsoft.AspNetCore.Http.IResult Content (string? content, string? contentType = default, System.Text.Encoding? contentEncoding = default, int? statusCode = default);
static member Content : string * string * System.Text.Encoding * Nullable<int> -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Content (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

Content(String, MediaTypeHeaderValue)

Source:
Results.cs

Writes the content string to the HTTP response.

public static Microsoft.AspNetCore.Http.IResult Content (string content, Microsoft.Net.Http.Headers.MediaTypeHeaderValue contentType);
public static Microsoft.AspNetCore.Http.IResult Content (string? content, Microsoft.Net.Http.Headers.MediaTypeHeaderValue contentType);
static member Content : string * Microsoft.Net.Http.Headers.MediaTypeHeaderValue -> Microsoft.AspNetCore.Http.IResult
Public Shared Function Content (content As String, contentType As MediaTypeHeaderValue) As IResult

Parameters

content
String

The content to write to the response.

contentType
MediaTypeHeaderValue

The content type (MIME type).

Returns

The created IResult object for the response.

Applies to