Please enable JavaScript.
Coggle requires JavaScript to display documents.
Request Processing Pipeline - Coggle Diagram
Request Processing Pipeline
Request Processing Pipeline works
Request Initialization
he ASP.NET Core framework initializes the HttpContext, which contains information about the current request, response, and other contextual data.
Middleware Execution
Process the request and generate a response.Modify the request, response, or HttpContext.Short-circuit the pipeline by not passing the request to the next middleware.
Response Generation
A response is generated once the request has traversed through all configured middleware components.The response can be generated by the last middleware component or by the application’s endpoint (controller action or Razor Page).
Response Middleware
After generating the response, the request flows back through the pipeline in reverse order, allowing response-related middleware to execute.
Response middleware can modify the response or perform additional operations before sending the response to the client.
Response Finalization
The response is sent back to the client.
Any cleanup or finalization tasks are performed.
Some common middleware
Routing Middleware
Handles URL routing and maps requests to appropriate controller actions or Razor Pages
Authentication Middleware
Handles user authentication and identity management.
Authorization Middleware
Enforces access control rules and permissions.
Static Files Middleware
Serves static files (e.g., CSS, JavaScript, images) directly from the file system.
CORS Middleware
Enforces Cross-Origin Resource Sharing (CORS) policies.
Logging Middleware
Logs information about the request and response.
Response Compression Middleware
Compresses responses before sending them to the client.
Exception Handling Middleware
Handles unhandled exceptions and provides error responses.
HTTP request
Middleware 1
your Logic here then add
next();
if you want pass the middleware to the next middleware
use
Use
method because use has the
next parameter
Middleware 2
your Logic here then add
next();
if you want pass the middleware to the next middleware
use
Use
method because use has the
next parameter
Middleware 2
your Logic here
use
Run
method terminate the pipeline here and process the request then response back to client in revers order