Вы должны:
0 - добавить параметр
<%@ OutputCache Duration="300" VaryByParam="*" Shared="True" VaryByCustom="x" VaryByControl="hdnButtonToForceUpdateCacheIfYouWantOnClick" %>
1 - расширение приложения SPHttp, IVaryByCustomHandler.
public class MyCache: SPHttpApplication, IVaryByCustomHandler {
public override void Init()
{
base.Init();
this.RegisterGetVaryByCustomStringHandler((Microsoft.SharePoint.ApplicationRuntime.IVaryByCustomHandler)this);
}
public string GetVaryByCustomString(HttpApplication app, HttpContext context, string custom)
{
StringBuilder sb = new StringBuilder();
string[] strings = custom.Split(';');
bool appended = false;
foreach (string str in strings)
{
switch (str)
{
case "x":
var xv= context.Request.Cookies.Get("x");
if (xv!= null)
{
sb.Append(xv.Value);
}
break;
}
}
return sb.toString();
}
}
2 - После изменения вашего global.asax,
<%@ Assembly Name="Microsoft.SharePoint"%>
<%@ Assembly Name="Energisa.Distribuidora.Webparts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e2d241931dc35e9d"%>
<%@ Import Namespace="(Namespace).Webparts" %>
<%@ Application Language="C#" Inherits="(Namespace).MyCache" %>
Подробнее в: https://msdn.microsoft.com/en-us/library/office/ms550239(v=office.14).aspx