HttpContext
HttpContext is an object that encapsulates all HTTP-specific information about a single HTTP request and its corresponding response within a web application. It provides access to the request data, the response to be sent, session and user information, and per-request data storage. In many frameworks, HttpContext is created at the start of a request and disposed at the end, allowing middleware, controllers, and services to share information during processing.
In the classic ASP.NET framework, HttpContext is defined in System.Web and includes properties such as Request,
In ASP.NET Core, HttpContext is part of Microsoft.AspNetCore.Http and is accessed via the HttpContext property on
Common usage includes reading request headers, query strings, form data, and cookies; writing response status codes,
Security and lifecycle notes: avoid relying on static state across requests; ensure proper disposal and consider