Now for every failure result I need to send the error message with http status code 400. how do I change the bad request to http status 400?
Here is my code:
public class Exams : System.Web.Services.WebService
{
[WebMethod]
public string addexam(string cust_name)
{
if (cust_name=="")
{
return "Invalid request";
}
BECommon objBECommon = new BECommon();
objBECommon.cust_name = cust_name;
string result = objBECommon.DsResult.Tables[0].Rows[0][0].ToString();
if (result == "1")
{
return "Customer exists";
}
else
{
return "invalid request";
}
// here i need to send the above error message with http status code 400.
}
}