locked
Best way to cache the results of a handler RRS feed

  • Question

  • User-177675290 posted

    Let me preface this by saying I do a couple of things that the docs say don't do, since they require internal ASP.NET functions.  Mainly, use the PageParser.GetCompiledPageInstance within my handler.

    Anyway, said function returns a Page object and I can use the "ProcessRequest"  function to allow my newly compiled page instance to do its thing.  I'd like to know the best way to capture the page output so I can do some specific type caching with it.  It's possible I can accomplish the caching with some built in functionality, but I've yet to figure it out.

    Essentially, I'd like to take the output from the page, and cache it differently based on the groups a logged in user belongs to.  This is easy enough if I can get a copy of the resulting HTML, but I'm unsure of how to do that.

    Sunday, February 26, 2006 11:53 AM

All replies

  • User1641955678 posted

    What I would do is call Server.Execute.  It has an override which takes a TextWriter, which lets you capture the output.

    David

    Tuesday, February 28, 2006 9:23 PM
  • User1641955678 posted

    One additional comment: you can avoid using the obsolete GetCompiledPageInstance by instead calling the new (to 2.0) BuildManager.CreateInstanceFromVirtualPath.  It basically does the same thing, and in fact GetCompiledPageInstance calls it internally.

    David

    Tuesday, February 28, 2006 9:24 PM
  • User-177675290 posted
    Cool, that's pretty much exactly what I was looking for.  And thanks for the heads up on that new .NET 2.0 function to replace my old and busted method. :)
    Tuesday, February 28, 2006 9:48 PM