views:

49

answers:

1

I have an App which users have to log into. Once logged in, they may perform a search against our database.

Their Identity can affect the search results.

I wish to use Cache pages of the results. VaryByParam sounds good for this.

However I do not understand the events that do or do not fire when a cached version of a page is returned.

I do not want another user to attempt to feed url params which might indicate another user account and therefore allow them access to someone elses results.

Therefore I need a server event which always fires even when a page is being returned from the cache so that I can check this ID Param against the session version of same.

However this also means that I cannot perform my search in this event as it would always run and therefore defeat the purpose of caching. So I need another event which only fires if the page is not being retrieved from the cache.

Which events run under these 2 sets of circumstances?

+1  A: 

Have you considered setting the Response cache properties to allow the client machine to cache the result? Use the SetCacheability method of the Cache policy on the response to set the cacheability to Private.

You don't really need server caching if each user may have different results, get the client cache to do the work.

AnthonyWJones