4
Answers

Async Await in asp.net core web api?

Karan Thakkar

Karan Thakkar

5y
17.4k
1
On first request method gets executed but on the second call it doesn't, I am aslo using await keyword?
 
The method which I am calling is not an async method?
 
When I debug the code user comes null once I logout and again login but by going inside the method with F11 user gets filled, can someone help me to understand this?
  1. public async Task<IActionResult> AuthenticateUser([FromBody] User user)  
  2. {  
  3. Login login = new Login();  
  4. user = await login.AuthenticateUser(user.LoginId, user.Password);  
  5. if (userDetails!=null)  
  6. {  
  7. return Ok(userDetails);  
  8. }  
  9. return BadRequest();  
  10. }  
Answers (4)