How do I get a custom IHttpHandler to Be Capable of Handling Page cache?
This is my code:
class HandlerTest : IHttpHandler,System.Web.SessionState.IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Response.Write(DateTime.Now.ToString());
context.Response.Cache.SetExpires(context.Timestamp.AddSeconds(10));
context.Response.Cache.SetMaxAge(new TimeSpan(0, 0, 10));
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Respon开发者_如何学运维se.Cache.SetLastModified(context.Timestamp);
context.Response.Cache.SetValidUntilExpires(true);
context.Response.Cache.VaryByParams.IgnoreParams = true;
context.Response.End();
}
public bool IsReusable
{
get { return true; }
}
}
It doesn't work. Who can tell me how should I do?
I know, When I removed this line ,it was be right.
context.Response.End();
I hope this question can help anyone.By the way,my English is very poor.
精彩评论