Alex I
Alex I

Reputation: 41

HttpResponse.Filter equivalent in ASP.NET Core

I'm currently migrating an ASP.NET 4 project to ASP.NET Core. I'm getting the error "HttpResponse does not contain a definition for 'Filter'".

What should I use instead of HttpResponse.Filter in ASP.NET Core?

Upvotes: 4

Views: 2431

Answers (1)

James Ellis-Jones
James Ellis-Jones

Reputation: 3092

I've looked at this, and really there is no replacement, basically because the way the pipeline works is that any middleware can write directly to the response and this could be flushed immediately. The only way to intercept it would be to substitute something into the place of the response stream that could buffer it and provide filtering functions. However having looked at the MVC source, this seems virtually impossible to achieve.

I really think MS should provide some extension point that lets you e.g. register a service to replace the output stream.

So hopefully you can work out a way to provide similar functionality through a different methodMV

Upvotes: 2

Related Questions