Results.Content 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Content(String, String, Encoding) |
将 |
Content(String, String, Encoding, Nullable<Int32>) |
将 |
Content(String, MediaTypeHeaderValue) |
将 |
Content(String, String, Encoding)
- Source:
- Results.cs
将 content
字符串写入 HTTP 响应。
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 响应。
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
内容编码。
返回
为响应创建 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 对象。