Question

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);
}
Was it helpful?

Solution

This thread might help you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top