我该如何在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")
}
}
RISEBY
相关分类