我想在asp.net core mvc中實作。如果有人知道,請告訴我。
uj5u.com熱心網友回復:
謝謝你的建議。這對我們很有幫助。
const string SessionName = "_Name";
const string SessionAge = "_Age";
public IActionResult Index()
{
HttpContext.Session.SetString(SessionName, "Jarvik");
HttpContext.Session.SetInt32(SessionAge, 24);
return View();
}
public IActionResult About()
{
ViewBag.Name = HttpContext.Session.GetString(SessionName);
ViewBag.Age = HttpContext.Session.GetInt32(SessionAge);
ViewData["Message"] = "Asp.Net Core !!!.";
return View();
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/327505.html
標籤:html asp.net-mvc 会议
上一篇:第二屆ENGINE沒有到期日
