ControllerBase.Content ControllerBase.Content ControllerBase.Content Method

Definition

Overloads

Content(String, String, Encoding) Content(String, String, Encoding) Content(String, String, Encoding)

Creates a ContentResult object with Status200OK by specifying a content string, a contentType, and contentEncoding.

Content(String, String) Content(String, String) Content(String, String)

Creates a ContentResult object with Status200OK by specifying a content string and a content type.

Content(String) Content(String) Content(String)

Creates a ContentResult object with Status200OK by specifying a content string.

Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue)

Creates a ContentResult object with Status200OK by specifying a content string and a contentType.

Content(String, String, Encoding) Content(String, String, Encoding) Content(String, String, Encoding)

Creates a ContentResult object with Status200OK by specifying a content string, a contentType, and contentEncoding.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, string contentType, System.Text.Encoding contentEncoding);
abstract member Content : string * string * System.Text.Encoding -> Microsoft.AspNetCore.Mvc.ContentResult
override this.Content : string * string * System.Text.Encoding -> Microsoft.AspNetCore.Mvc.ContentResult
Public Overridable Function Content (content As String, contentType As String, contentEncoding As Encoding) As ContentResult
Parameters
content
String String String

The content to write to the response.

contentType
String String String

The content type (MIME type).

contentEncoding
Encoding Encoding Encoding

The content encoding.

Returns

The created ContentResult 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.

Content(String, String) Content(String, String) Content(String, String)

Creates a ContentResult object with Status200OK by specifying a content string and a content type.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, string contentType);
abstract member Content : string * string -> Microsoft.AspNetCore.Mvc.ContentResult
override this.Content : string * string -> Microsoft.AspNetCore.Mvc.ContentResult
Public Overridable Function Content (content As String, contentType As String) As ContentResult
Parameters
content
String String String

The content to write to the response.

contentType
String String String

The content type (MIME type).

Returns

The created ContentResult object for the response.

Content(String) Content(String) Content(String)

Creates a ContentResult object with Status200OK by specifying a content string.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content);
abstract member Content : string -> Microsoft.AspNetCore.Mvc.ContentResult
override this.Content : string -> Microsoft.AspNetCore.Mvc.ContentResult
Public Overridable Function Content (content As String) As ContentResult
Parameters
content
String String String

The content to write to the response.

Returns

The created ContentResult object for the response.

Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue) Content(String, MediaTypeHeaderValue)

Creates a ContentResult object with Status200OK by specifying a content string and a contentType.

[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, Microsoft.Net.Http.Headers.MediaTypeHeaderValue contentType);
abstract member Content : string * Microsoft.Net.Http.Headers.MediaTypeHeaderValue -> Microsoft.AspNetCore.Mvc.ContentResult
override this.Content : string * Microsoft.Net.Http.Headers.MediaTypeHeaderValue -> Microsoft.AspNetCore.Mvc.ContentResult
Public Overridable Function Content (content As String, contentType As MediaTypeHeaderValue) As ContentResult
Parameters
content
String String String

The content to write to the response.

contentType
MediaTypeHeaderValue MediaTypeHeaderValue MediaTypeHeaderValue

The content type (MIME type).

Returns

The created ContentResult object for the response.

Applies to