Results.Content 方法

定义

重载

Content(String, String, Encoding)

content 字符串写入 HTTP 响应。

这相当于 Text(String, String, Encoding)

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

content 字符串写入 HTTP 响应。

这相当于 Text(String, String, Encoding, Nullable<Int32>)

Content(String, MediaTypeHeaderValue)

content 字符串写入 HTTP 响应。

Content(String, String, Encoding)

Source:
Results.cs

content 字符串写入 HTTP 响应。

这相当于 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

参数

content
String

要写入响应的内容。

contentType
String

内容类型(MIME 类型)。

contentEncoding
Encoding

内容编码。

返回

为响应创建 IResult 对象。

注解

如果编码由“charset”和 contentEncoding 参数提供,则选择 contentEncoding 参数作为最终编码。

适用于

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

Source:
Results.cs

content 字符串写入 HTTP 响应。

这相当于 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

参数

content
String

要写入响应的内容。

contentType
String

内容类型(MIME 类型)。

contentEncoding
Encoding

内容编码。

statusCode
Nullable<Int32>

要返回的状态代码。

返回

为响应创建 IResult 对象。

注解

如果编码由“charset”和 contentEncoding 参数提供,则选择 contentEncoding 参数作为最终编码。

适用于

Content(String, MediaTypeHeaderValue)

Source:
Results.cs

content 字符串写入 HTTP 响应。

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

参数

content
String

要写入响应的内容。

contentType
MediaTypeHeaderValue

内容类型(MIME 类型)。

返回

为响应创建 IResult 对象。

适用于