title: Disable caching on a partial view in MVC 3
body: <p>I have an issue with a partial View being cached when it shouldn't be. This partial View is used to display the Logon/Logoff on a page.  It uses the simple code below to figure out which link to display </p>
  
  <pre><code>@if(Request.IsAuthenticated) {    
      &lt;a href="@Url.Action("LogOff", "Account", new { area = "" })"&gt;Log Off&lt;/a&gt; 
  }
  else {
      &lt;a href="@Url.Action("LogOn", "Account", new { area = "" })"&gt;Log On&lt;/a&gt;
  }
  </code></pre>
  
  <p>This partial View is called from with all pages in my MVC3 application, using </p>
  
  <pre><code>@Html.Partial("_HeaderView")  
  </code></pre>
  
  <p>In most of my controllers, I have the output cache defined, so I can take advantage of caching my content. </p>
  
  <pre><code>[OutputCache(Duration = 86400, VaryByParam = "*")]
  </code></pre>
  
  <p>Now my issue is that the entire page is being cached when I don't want the partial view to be. This is causing wrong behavior where in it sometimes displays LogOff even if the user is not logged in etc.  Is there a way to cache all the content, except for the partial view in question? </p>