0

I have an HTTPHandler that returns some XML. I am trying to figure out how to get this to cache in the browser, as if it were a static XML file.

I've tried this along with a few other variations and other Cache options, but nothing I do seems to make it cache (according to Fiddler).

Any ideas on how I can cache the output on the client's browser?

public void ProcessRequest(HttpContext context)
{
        context.Response.ContentType = "text/xml";
        context.Response.ContentEncoding = System.Text.Encoding.UTF8;

        context.Response.Cache.SetCacheability(HttpCacheability.Private);
        context.Response.Cache.SetMaxAge(new TimeSpan(1, 0, 0));

        string sXml = GetTableAsXml();
        context.Response.Write(sXml);
}
TomF
  • 98
  • 7
  • Possible duplicate of [Image from HttpHandler won't cache in browser](http://stackoverflow.com/questions/994135/image-from-httphandler-wont-cache-in-browser) – JKennedy Apr 05 '17 at 09:37

1 Answers1

0

This thread might help you.

Community
  • 1
  • 1
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928