How to change HTTP response using filters in asp.net?
These components are called filters in the Java world. They can modify the requests / responses before they are sent to the handler component accordingly. before the response is delivered to the client.
ASP.NET calls these components HTTP Modules .
source to share
Using:
answer
purpose
The response object is an instance of the Servlet API
HttpServletResponse
class<strong> Examples
class BookController { def downloadFile = { byte[] bytes = // read bytes response.outputStream << bytes } }
Description
The Servlet API class
HttpServletResponse
can be used internally by Grails to do all the common things like writing binary data files, directly writing the response, and sending error response codes to denote, but a few.
Quote from here .
source to share
Historically, response filters have been the way to do this in ASP.NET. However, they suffer from some serious cache-related issues, both in IIS6 (harder to notice) and IIS7. This question contains an article with more details.
source to share