How to change HTTP response using filters in asp.net?

Modifying the HTTP response using filters

+1


source to share


4 answers


I think the question is related to ASP.NET and not Java. This can help:



http://professionalaspnet.com/archive/2008/04/13/What-is-the-Difference-between-an-httpModule-and-an-httpHandler_3F00_.aspx

+1


source


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 .

+1


source


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 .

0


source


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.

0


source







All Articles