Scenario bases Question
https://chatgpt.com/c/6a0d671d-37cc-8321-bc6c-4a4b80d6a293 1. The Custom Pipeline Scenario : "Your application needs to intercept every incoming request to check for a specific custom header. If missing, it must redirect to a maintenance page without hitting the controller. How do you implement this? For this scenario, Middleware is the correct choice — not an Action Filter. Why? Because the requirement is: Inspect every incoming HTTP request Check for a custom header Short-circuit the pipeline early Redirect before MVC/controllers execute That is exactly what ASP.NET Core middleware is designed for. Why Middleware is Better Than Action Filters Middleware Runs Earlier in the Pipeline Middleware executes before the request reaches MVC . Pipeline flow: Request ↓ Middleware ↓ Routing ↓ MVC / Controllers ↓ Action Filters ↓ Controller Action So if the header is missing: Middleware can stop processing immediately No controller instantiation No ...