Carlos Blanco
Carlos Blanco

Reputation: 8772

Middleware scoped to a route in MVC 6

How can be written middleware that is executed on specific routes using MVC 6? This can be done in the precious version of the WebAPI using a DelegatingHandler, I can't find a way of doing it in MVC 6 though.

Upvotes: 1

Views: 542

Answers (1)

Joe Audette
Joe Audette

Reputation: 36736

something like this should do it I think

PathString path = new PathString("/somefolder");
app.Map(path,
appBranch =>
{
    // add middleware needed for this branch

});

Upvotes: 2

Related Questions