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);
}
This thread might help you.
精彩评论