I am using .NET core 2.2 API and with that trying to run server-side serial number validation. I saw the PHP implementation where for invalid key we are returning:
Code: Select all
return LICENSE_INVALID . $msg_sep . "Serial Number: " . $posted_serial . ' is invalid !';
I tried below options but none working:
Code: Select all
return Ok(new { AnswerCode = 602, Message = "The serial number is invalid" });
return StatusCode(602, "The serial number is invalid");
return Ok("602\r\nThe serial number is invalid");
Code: Select all
[HttpPost]
public async Task<IActionResult> VerifyKey(string key)
{
try
{
var response = await VerifyKeyFromDb(key);
if(response == null)
{
return Ok("602\r\nThe serial number is invalid");
}
return Ok(601);
}
catch (Exception e)
{
// exception code
}
}