locked
Help! How to OutputCache in HttpHandler? RRS feed

  • Question

  • User-699214092 posted
    I want to use something like this <%@ OutputCache Duration="100" VaryByParam="none" %>
    in an  .ashx page (HttpHandler).

    Is that possible?
    Sunday, October 9, 2005 1:41 AM

All replies

  • User-185961193 posted
    HttpHandler is not a .aspx or .ascx file. It is not meant to render itself.

    The whole purpose of Output Cache is to spit a HTML string stored in memory that is the output of the page whereas HttpHandler are meant to put a Hook in between request and destination object and apply certain conditions or manipulate the request so that doesn't make sense.

       If you want to use HttpHandlers for putt headers or footers in every page then you might be better of using MaterPage and shared User Control
    Sunday, October 9, 2005 7:10 PM
  • User-699214092 posted
    I want to use a httphandler (.ashx) to generate a javascript file.
    and I want to use something like this for it <%@ OutputCache Duration="300" VaryByParam="none" %>

    so the only way is to use a StringBuilder and then Cache.Insert etc...?
    Sunday, October 9, 2005 8:57 PM
  • User-185961193 posted
    Yes that is correct. The Httphandler instance need to exist for it to be in the ASp.Net pipeline.
    Monday, October 10, 2005 9:20 AM
  • User-177675290 posted

    That's an HttpModule, not a handler.  A handler is meant for requests that shouldn't be done as an aspx page (such as a dynamic javascript file).

     Surely there's a way to make trigger the OutputCache using an HttpHandler?

    Tuesday, September 12, 2006 2:46 PM