Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 716
Alex I Avatar asked Oct 20 '25 13:10

Alex I


1 Answers

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

like image 130
James Ellis-Jones Avatar answered Oct 23 '25 04:10

James Ellis-Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!