Owin Middleware Example in VB.Net

I couldn't find an example of Owin Middleware for VB.Net anywhere. After much experimentation I came up with this simple example:

    Public Class SimpleMiddleware
        Inherits OwinMiddleware

        Public Sub New(nextMiddleware As OwinMiddleware)
            MyBase.New(nextMiddleware)
        End Sub

        Public Overrides Async Function Invoke(context As IOwinContext) As Task

            Console.WriteLine("Hello OWIN")
            Await Me.Next.Invoke(context)
        End Function

    End Class

To use it add the following to your Startup class

 app.Use(GetType(SimpleMiddleware))
Ben Sudbury Avatar

Ben Sudbury

For more information about Ben Sudbury check the bio at the link below.

http://www.lighthouselogic.com/about-me/

comments powered by Disqus