MvcNewtonsoftJsonOptions.AllowInputFormatterExceptionMessages 属性

定义

获取或设置一个标志,用于确定是否将来自 JSON 反序列化的NewtonsoftJsonInputFormatter错误消息添加到 。ModelStateDictionary 如果 false为 ,则将改用一般错误消息。

public:
 property bool AllowInputFormatterExceptionMessages { bool get(); void set(bool value); };
public bool AllowInputFormatterExceptionMessages { get; set; }
member this.AllowInputFormatterExceptionMessages : bool with get, set
Public Property AllowInputFormatterExceptionMessages As Boolean

属性值

默认值为 true

注解

中的 ModelStateDictionary 错误消息通常以 HTML 格式或使用 BadRequestObjectResult传达给客户端。 实际上,此设置控制客户端是否可以接收有关提交的 JSON 数据的详细错误消息。

适用于