我該如何在ApiController中將帶有“無效用戶名”之類的文本的Bad Request異常返回到前端。我的代碼:public class FrontEndController : ApiController { public string Test(string value) { if(!isValid(value)) //how do i throw exception with its code (400 in this case) and message ("Invalid username") } }
如何將具有錯(cuò)誤說明(無效的用戶名或無效的密碼)
慕運(yùn)維8079593
2021-05-06 14:19:20