title: ASP.NET TempData persists between requests
body: <p>I am using temp data as follow in my controllers - very simple, when there is a problem:</p>
  
  <pre><code>TempData("StatusMessage") = "You have no items set to Auto-Ship."
  </code></pre>
  
  <p>Then on every page I have a user control as follows:</p>
  
  <pre><code>&lt;div class="error-container"&gt;
  &lt;%  If TempData.ContainsKey("ErrorMessage") Then%&gt;
  &lt;script&gt; $('div.error-container').show();&lt;/script&gt;
  &lt;div class="msg-error"&gt;&lt;p&gt;&lt;%=TempData("ErrorMessage") %&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;% End If%&gt;
  &lt;%  If TempData.ContainsKey("StatusMessage") Then%&gt;
  &lt;script&gt; $('div.error-container').show();&lt;/script&gt;
  &lt;div class="msg-status"&gt;&lt;p&gt;&lt;%=TempData("StatusMessage")%&gt;&lt;/p&gt;&lt;/div&gt;
  &lt;% End If%&gt;
  &lt;ul&gt;&lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Problem is when I do have an error added to tempdata it shows up properly on the first request but ALSO shows up again on the next request as well - which is obviously very confusing and not a desired behavior.</p>
  
  <p>I am not using any IoC, I did see the post with the same problems when using that.</p>