Q27.webp
A

Q27.webp

Kizspy | Question: 27
(Choose 1 answer)
What is the primary purpose of ViewBag and ViewData in ASP.NET Core?
// Controller
public lActionResult Index()
ViewBag.Message = "Hello from ViewBag!";
ViewData["Title"] = "My Page Title";
return View();
// View
<p>@ViewBag.Message</p>
<h1>@ViewData["Title"]</h1>
A. To store data persistently across multiple requests.
B. To pass data from a controller action to a view.
C. To manage user sessions.
D. To encrypt sensitive data.
  • Like
Reactions: namnamnam1305

Thông tin

Category
PRN222
Thêm bởi
Arata2004
Ngày thêm
Lượt xem
1,905
Lượt bình luận
9
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom