ResponseContentTypeHelper Class

Namespace
Microsoft.AspNetCore.Mvc.Internal
Assemblies
  • Microsoft.AspNetCore.Mvc.Core

Syntax

public class ResponseContentTypeHelper
class Microsoft.AspNetCore.Mvc.Internal.ResponseContentTypeHelper

Methods

ResolveContentTypeAndEncoding(System.String, System.String, System.String, out System.String, out System.Text.Encoding)

Gets the content type and encoding that need to be used for the response. The priority for selecting the content type is: 1. ContentType property set on the action result 2. Microsoft.AspNetCore.Http.HttpResponse.ContentType property set on Microsoft.AspNetCore.Http.HttpResponse 3. Default content type set on the action result

Arguments:
  • actionResultContentType (System.String) – ContentType set on the action result
  • httpResponseContentType (System.String) – Microsoft.AspNetCore.Http.HttpResponse.ContentType property set on Microsoft.AspNetCore.Http.HttpResponse
  • defaultContentType (System.String) – The default content type of the action result.
  • resolvedContentType (System.String) – The content type to be used for the response content type header
  • resolvedContentTypeEncoding (System.Text.Encoding) – Encoding to be used for writing the response
public static void ResolveContentTypeAndEncoding(string actionResultContentType, string httpResponseContentType, string defaultContentType, out string resolvedContentType, out Encoding resolvedContentTypeEncoding)