OWIN has a concept of middleware. So does ASP.NET 5. Why? What is middleware? How does it help in typical web applications? In this talk we will dive into the code, write some middleware and show how middleware helps you handle cross-cutting concerns in an isolated and re-usable way. I'll compare and contrast the OWIN and ASP.NET 5 middleware concepts and talk about where each is appropriate.
7. Things You Might Do In the Pipeline
Open & dispose resources
Logging
Authentication
Authorization
Quick monitoring endpoints
Sanitize inputs
Content Negotiation
CORS
7
8. Things You Might Do In the Pipeline
Open & dispose resources
Logging
Authentication
Authorization
Quick monitoring endpoints
Sanitize inputs
Content Negotiation
CORS
8
Cross-cutting concerns
Re-use
Test separately
Update separately
Distribute separately
18. OWIN – Response Environment
Required Key Name
Yes "owin.ResponseBody"
Yes "owin.ResponseHeaders"
No "owin.ResponseStatusCode"
No "owin.ResponseReasonPhrase"
No "owin.ResponseProtocol"
19. OWIN Terminology
19
using MidFunc = Func<AppFunc, AppFunc>;
Handler
Log request
Log response
Authenticate
Open DbContext
Close DbContext