Sunday, July 25, 2010

How to invalidate a asp.net response cache based on a condition - Asp.net

protected override void OnLoad(EventArgs e)
{
    base.OnLoad(e);
    this.Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(ValidateCacheOutput), null);
}
protected void ValidateCacheOutput(HttpContext context, object data, ref HttpValidationStatus status)
{
    string name = context.Request.QueryString.Get("name");
    if (name.ToLower().Equals("john"))
        status = HttpValidationStatus.IgnoreThisRequest;
    else
        status = HttpValidationStatus.Valid;
}

No comments:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...