I tried below code to read username/password from body, but all i am getting is 'object reference not set to an instance of an object'
Code of API:
[Route("api/login_test")]
[HttpGet]
public object login_test([FromBody] string[] Username_Password])
{
string UsernameOrEmail_address, Password;
UsernameOrEmail_address = Username_Password[0];
Password = Username_Password[1];
return UsernameOrEmail_address + " " + Password;
}
by Changing the Http request it worked, replacing from HttpGet to HttpPost
[Route("api/login_test")]
[HttpPost]
public object login_test([FromBody] string[] Username_Password])
{
string UsernameOrEmail_address, Password;
UsernameOrEmail_address = Username_Password[0];
Password = Username_Password[1];
return UsernameOrEmail_address + " " + Password;
}