0
I wanted to know how to clean or hide data that I pass through a URL to a webapi so that the data n become apparent and do not disturb my routes..
following example:
http://localhost:65286/Cliente/Login?Email=alguem%40gmail.com&Password=123123123
public IActionResult Login(string Email, string Password)
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, BaseUrlFuncionario + "/Login/"+ Email +"/"+ Password);
HttpResponseMessage response = HttpInstance.GetHttpClientInstance().SendAsync(request).Result;
Funcionario funcionario = new Funcionario();
string l = response.Content.ReadAsStringAsync().Result;
funcionario = JsonConvert.DeserializeObject<Funcionario>(l);
if (response.IsSuccessStatusCode)
{
TempData["Funcionario"] = funcionario;
return View("Principal", TempData);
}
else
{
return BadRequest();
}
}
By what you wrote, you are making 'GET' requests for login validation. It has how to publish your code that calls the API?
– Felipe
I edited the question by inserting my method
– Thiago Oliveira
the API is yours, can you change its code? :
new HttpRequestMessage(HttpMethod.Post, BaseUrlFuncionario + "/Login/"+ Email +"/"+ Password);
. But your api has to be ready to receive POST and not GET requests– Felipe
Thanks, I changed everything to post and it worked!!!
– Thiago Oliveira
If everything worked, mark as answered, will help those next who view the question
– Felipe