用 TempData 來傳
範例:
XXController.cs
public ActionResult action1 () {
TempData["message"] = "test123";
return RedirectToAction("action2");
}
public ActionResult action2 () {
return View();
}
action2 View(Razor)
<script>
alert(@TempData["message"]);
</script>
範例:
XXController.cs
public ActionResult action1 () {
TempData["message"] = "test123";
return RedirectToAction("action2");
}
public ActionResult action2 () {
return View();
}
action2 View(Razor)
<script>
alert(@TempData["message"]);
</script>