我有一个REST服务,我想要有一个处理异常的助手类[WebGet(UriTemplate = "/Test/{param}")] else RESTException(System.Net.HttpStatusCode.BadRequesthttpStatusCode; // or anything you
问题是,当我没有在指定的字段中输入任何内容时,我的消息不会显示,我只得到一条类似于空字符串( "“)的消息。此外,如果我有一个int类型的字段,而我没有在该字段中输入任何内容,则模型状态是无效的。如果我没有在必填字段中输入任何内容,我如何跳过转换错误以及如何获得正确的错误消息?提前谢谢。这是我的代码:public class Car
我目前正在构建Web,当DataAnnotation验证中出现错误时,我在显示响应时遇到问题public class NewPatient [StringLength(13)][Required(ErrorMessage = "Format Nomor Kartu Tidak Sesuai")] [Required(ErrorMessage = "Forma
我正在学习c#中的web api。我想知道如何从服务器端发送的响应对象中捕获异常消息。{catch{Exception exception)
var errorMessage = new HttpResponseMessage(HttpStatusCode.BadRequestContent = new StringContent(ex