title: Why GetVaryByCustomString is not called
body: <p>output cache is implemented in ASP.NET MVC2 using code below.</p>
  
  <p><code>GetVaryByCustomString</code> method is not called: placing breakpoint to its first line and running application shows that breakpoint is not reached.
  Breakpoint in controller Index() is reached.</p>
  
  <p>How to use <code>VaryByCustom</code>  in ASP.NET MVC2 ?</p>
  
  <p>Controller:</p>
  
  <pre><code>        [OutputCache(VaryByCustom = "user")]
          public ActionResult Index(string _entity, string id)
          {
  ...
  </code></pre>
  
  <p>Global.asax.cs:</p>
  
  <pre><code>public class MvcApplication : System.Web.HttpApplication
  {
      public  override string GetVaryByCustomString(HttpContext context, string arg)
      {
          if (arg == "user")
          {
              HttpCookie cookie = context.Request.Cookies["Company"];
              if (cookie != null)
                  return Thread.CurrentPrincipal.Identity.Name + "," + cookie.Value;
              return Thread.CurrentPrincipal.Identity.Name;
          }
          return base.GetVaryByCustomString(context, arg);
      }
  
  }
  </code></pre>