TempData["ErrorMessage"] = "Invalid username or password";
TempData.AddErrorMessage("Product not found");This is another way of adding an error message to TempData. The AddErrorMessage method is a shorthand method that makes it easier to add error messages. This method is part of the Microsoft.AspNetCore.Mvc.ViewFeatures package. Package Library: Microsoft.AspNetCore.Mvc.ViewFeatures