6. Which of the following is true about how TempData handles data?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "It stores data in session state or cookies, depending on configuration". TempData dùng để giữ dữ liệu qua ĐÚNG một lần chuyển hướng, và nơi lưu phụ thuộc vào provider được cấu hình: mặc định trong ASP.NET Core là CookieTempDataProvider - lưu vào cookie đã mã hoá; nếu đăng ký SessionStateTempDataProvider thì dữ liệu nằm trong session state. Vì vậy phát biểu đúng là lưu trong session hoặc cookie tuỳ cấu hình. Phương án "It stores data in memory only" sai vì dữ liệu không chỉ nằm trong bộ nhớ tiến trình; các phương án "It stores data in the database" và "It stores data in the file system" sai vì TempData không ghi xuống cơ sở dữ liệu hay hệ thống tệp.
Cùng chương 4
With AddTransient<EmailService, EmailService>(), injecting into a controller twice will produce:Có lời giảiCâu hỏiConsider this C# code: public IActionResult Save(Person person) { if (ModelState.IsValid) return Content("Valid"); return Content("Error"); } If no value for Age is passed and Age is int, what happens?Có lời giảiCâu hỏiConsider this C# code: public class Person { public int Age { get; set; } } public IActionResult Save(Person person) { if (!ModelState.IsValid) { return Content("Invalid!"); } return Content("OK"); } Input: Age = "abc"? What is the output?Có lời giảiCâu hỏiCả 20 câu của chủ đề20 câu