Try our conversational search powered by Generative AI!

Moment 22 outputcache, is this possible?



We are using output cache for current application but for some requests we dont want to response with outputcached content i.e request must hit our business logic. I now that I can use varybyprarams and headers but this will generate a lot of outputcached content and there is a 'risk' to use a lot of memory so we have tried another apporach...

What we have tried is in PageInit of our master page we do:

Response.Cache.AddValidationCallback(new HttpCacheValidateHandler(ValidateCacheOutput), null);

and ValidateCacheOutput-delegate looks like:

public static void ValidateCacheOutput(HttpContext context, Object data, ref HttpValidationStatus status)
   if (){
      status = HttpValidationStatus.IgnoreThisRequest;

This works fine but it looks like if user are not logged in and user hits: status = HttpValidationStatus.IgnoreThisRequest;

It will not respond with already saved output cached content but...

it will go into business logic for current page and generate new outputcahced content that 'not logged in people' will get when visiting mainproblem is that if-condition must also apply for not logged in visitors else  it could have been working so.... 

Is there a way to tell Episerver to not generate outputcached content for current request (of page) if contidion is fullfilled.

Would be glad if anyone could help me solving this or point me in right direction how to approach this problem

[Pasting files is not allowed]

Oct 10, 2014 12:44

Is SetCachePolicy what you are looking for? See

Oct 10, 2014 16:25

Thanks, that could maybe help me.

In my case I'm controlling request-head-information so you if I get a hit for request-head-info you are saying that if I'm doing:


episerver will not generate  output cached content for specific url?


Oct 10, 2014 17:46

EPiServer sets the output caching the method SetCachePolicy, so unless the you call the base implementation you are in full control.

Oct 13, 2014 8:35
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.