Skip to content

Example usage

Martin Halliday edited this page Jul 8, 2016 · 3 revisions

The source code for the OWIN Framework contains a project called ExampleUsage which shows examples of how to use the OWIN Framework to write middleware and configure middleware into the application's owin pipeline. The ExampleUsage project is a console application that uses the Microsoft self hosting package to listen on a port and serve requests. When you start the application it will print some urls in the console window that you can put access with your browser of choice to see everything working.

The ExampleUsage project has the following classes. These classes contain extensive comments to help you to understand the techniques that they demonstrate:

Class Demonstrates
StartupSimple How to configure a very simple OWIN pipeline
StartupRouting How to configure a complex OWIN pipeline with routing
DoNothing The minimum footprint of a middleware class
RestServiceMapper How to handle a request and return a Json response
ReportExceptions How to chain downstream middleware and perform further processing after the downstream middleware has executed
PrintRequest How to take part in the routing phase of request processing
AllowEverythingAuthorization How to communicate information to downstream middleware
TemplatePageRendering How to write middleware that has dependencies and communicate upstream to the middleware that it depends on
FormsIdentification How to provide both upstream and downstream communication
InProcessSession How to provide a way for downstream middleware to communicate back upstream. This is a complete working implementation of session, but is not production grade.

Clone this wiki locally