JavaScript is required

Cho đoạn lệnh sau, xác định chức năng của đoạn lệnh?

sub Page_Load(obj as object, e as eventArgs)

dim strVariable as string

'set up some cookie variables

Response.Cookies("MyASPNETPage")("Username") = "Sinhvien"

Response.Cookies("MyASPNETPage")("Password") = "TakeMeHome"

Response.Cookies("MyASPNETPage")("Preference") = "800x640"

Response.Cookies("MyASPNETPage")("UserAgent") = _

Request.ServerVariables("HTTP_USER_AGENT")

for each strVariable in Response.Cookies("MyASPNETPage").Values

lblCookies.Text += "" & strVariable & ": " & _

Request.Cookies("MyASPNETPage")(strVariable) & "
"

next

end sub

A.

A.Dùng Respone để lưu trữ 1 số thông tin

B.

B.Dùng Request để lưu trữ 1 số thông tin

C.

Dùng Variables để lưu trữ 1 số thông tin

D.

Dùng Cookies để lưu trữ 1 số thông tin

Trả lời:

Đáp án đúng: D


Đoạn lệnh sử dụng `Response.Cookies` để tạo và lưu trữ các cookie (thông tin) trên máy khách. Sau đó, nó sử dụng `Request.Cookies` để đọc các cookie này và hiển thị nội dung của chúng lên `lblCookies`. Vì vậy, chức năng chính của đoạn lệnh là dùng cookies để lưu trữ thông tin.

Câu hỏi liên quan