Trung BìnhC# iconC#

HttpContext là gì và cách sử dụng như thế nào?

HttpContext đóng gói thông tin HTTP request/response, có thể truy cập qua ControllerBase.HttpContext hoặc IHttpContextAccessor.

  • Truy cập request properties: Request.Headers, Request.Query, Request.Path, User identity.
  • Dùng cho các thao tác context-specific như set response headers, đọc user claims, hay truyền dữ liệu qua request pipeline.

Xem toàn bộ C# cùng filter theo level & chủ đề con.

Mở danh sách C#