Good morning, I have the following problem, I need to pass a variable to another controller and I'm trying to do this for TempData, it follows the code:
var user = User.Identity.GetUserId();
var getUser = db.AspNetUsers.FirstOrDefault(x => x.Id.Equals(user));
var userName = getUser.Nome;
TempData["UsuarioTemp"] = UsuarioTemp;
This code above is in the HomeController, and I want to call this TempData in the XmlController that would be this:
HomeController ArquivoX = new HomeController();
var NomeUsuario = ArquivoX.TempData["UsuarioTemp"];
The problem is that every time I execute this method and TempData returns as Null, and I do not know how to solve. If someone can help I thank.