📜  asp.net mvc 临时数据 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:43.991000             🧑  作者: Mango

代码示例1
TempData good to knows:
- IMPORTANT! TempData is discarded after the next request completes!!
- Assume that the data is in string format
- You can have multiple variables stored

Usage:

String example:
string message = TempData["message"]; // Get data from TempData
TempData["message"] = message; // Set data into TempData

Int example:
int number = Int.Parse(TempData["message"]); // Get data from TempData
TempData["message"] = message; // Set data into TempData