Peuge
Peuge

Reputation: 1501

Outputcache IIS 7 on dynamic pages with postbacks

I enabled output caching in IIS 7 and varied it by all querystrings, using *. However some pages do not act correctly. For instance I have a login page which has a asp:LinkButton which when clicked should log the user in and redirect them. However IIS has cached this page and so all that happens when I click login is the page reloads. What suggestions would you have to avoid this expected behaviour for some pages while preserving it on otheres?

Thanks in advance.

Upvotes: 0

Views: 272

Answers (1)

Sarin
Sarin

Reputation: 1285

You can't do this. How output caching works is by caching the rendered html for the page against the specified parameters - in your case, any query string. When you click the link button causing a postback, it is essentially a form post to the same page i.e. same URL, same query string. So the OutputCache module is going to find a match and serve that back, skipping your Page life cycle. The postback, therefore will not be processed.

What you can try is caching only GETs.

Upvotes: 1

Related Questions