ControllerBase.Content Method

Definition

Overloads

Content(String, String, Encoding)

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

Content(String, String)

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

Content(String)

Creates a ContentResult object by specifying a content string.

Content(String, MediaTypeHeaderValue)

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

Content(String, String, Encoding)

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

public:
 virtual Microsoft::AspNetCore::Mvc::ContentResult ^ Content(System::String ^ content, System::String ^ contentType, System::Text::Encoding ^ contentEncoding);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, string contentType, System.Text.Encoding contentEncoding);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

The content to write to the response.

contentType
String

The content type (MIME type).

contentEncoding
Encoding

The content encoding.

Returns

ContentResult

The created ContentResult object for the response.

Attributes

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)

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

public:
 virtual Microsoft::AspNetCore::Mvc::ContentResult ^ Content(System::String ^ content, System::String ^ contentType);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, string contentType);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

The content to write to the response.

contentType
String

The content type (MIME type).

Returns

ContentResult

The created ContentResult object for the response.

Attributes

Content(String)

Creates a ContentResult object by specifying a content string.

public:
 virtual Microsoft::AspNetCore::Mvc::ContentResult ^ Content(System::String ^ content);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

The content to write to the response.

Returns

ContentResult

The created ContentResult object for the response.

Attributes

Content(String, MediaTypeHeaderValue)

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

public:
 virtual Microsoft::AspNetCore::Mvc::ContentResult ^ Content(System::String ^ content, Microsoft::Net::Http::Headers::MediaTypeHeaderValue ^ contentType);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual Microsoft.AspNetCore.Mvc.ContentResult Content (string content, Microsoft.Net.Http.Headers.MediaTypeHeaderValue contentType);
[<Microsoft.AspNetCore.Mvc.NonAction>]
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

The content to write to the response.

contentType
MediaTypeHeaderValue

The content type (MIME type).

Returns

ContentResult

The created ContentResult object for the response.

Attributes

Applies to