1

I have a MVC page being hit by a normal form post with 2 post parameters.

SupplierId and Repayment.

Before adding the form I used Outputcache on the action like:

[OutputCache(Duration = 86400, VaryByCustom = "pageurl")]
public override ActionResult Load(int ControlId)
{

Everything worked when the url changed.

Now I want it to vary by the post parameters aswell, so I changed it to:

[OutputCache(Duration = 86400, VaryByCustom = "pageurl", VaryByParam = "SupplierId;Repayment")]
public override ActionResult Load(int ControlId)
{

This does not work. It does not cache separat result for different post params. If I request the same url with different post params I keep getting the initial cached result. The break point in Visual Studio is not being hit either.

Can someone tell me what I might be doing wrong?

tereško
  • 58,060
  • 25
  • 98
  • 150
Jacob
  • 409
  • 1
  • 6
  • 16

1 Answers1

1

VaryByParam relates to the parameters passed into this method. The only param you have is int ControlId.

To VaryByParam = "SupplierId;Repayment" you would need:

[OutputCache(Duration = 86400, VaryByCustom = "pageurl", VaryByParam = "SupplierId;Repayment")]
public override ActionResult Load(int SupplierId, int Repayment)
{
}
Rebecca
  • 13,914
  • 10
  • 95
  • 136