I have a problem to convert TempData["Id"] to int. I assign an int value to the TempData["Id"], and want to use it as int. Here is my code:
TempData["Id"] = 1;
int Id= (int)TempData["Id"];
But it didn't work. The Id is null. I try to use some suggestion like
Convert.ToInt32(TempData["Id"];
Convert.ToInt32(TempData["Id"].ToString());
But it also shows null. Please help