VaryByParam no working with POST

Feb 20, 2012 at 4:11 PM
Edited Feb 20, 2012 at 4:56 PM

It appears that a cached action is not properly keyed (VaryByParam) when the parameters are submitted via POST.

It worked properly when the parameters where submitted via GET.

Feb 21, 2012 at 10:22 AM

Interesting. Wasn't aware that built-in OutputCache worked with POST data, but just checked and you are right. Will add this functionality in the next release.

Feb 21, 2012 at 2:25 PM

Although it provides no true security, I always use posts in my ajax calls to discourage querystring tampering.

In case you you run into it during implementation, form values take precedence over querystring values when both are present (for the same key).

Mar 23, 2012 at 10:36 AM

Added to 1.2 release. Let me know if there are any issues.

Dec 21, 2012 at 7:22 PM

I am using 1.2.1 and I'm noticed that this still isn't working. I have an action marked with [ConfiguredOutputCache(VaryByParam="*")]. When I use a GET and different querystrings it seems to work properly. But when accessing it with POST (coming from an ajax call in my javascript), it is not varying by parameter. It caches the first POST and uses that for all subsequent POSTs.

Dec 9, 2013 at 10:52 AM
I just download the last version (1.2.3) and it still not working.

POST json data by ajax request is caching the first request ignoring varybyparam. outputcache works fine. The parameters are inside inputStream in the request payLoad.