Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.NET OutputCache and Cookies
    primarykey
    data
    text
    <p>Does anyone know why if is have cookies on my page, the output cache does not work !</p> <p>Example page</p> <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="ct.aspx.vb" Inherits="ct" %&gt; &lt;%@ OutputCache Duration="600" Location="Server" VaryByParam="none" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;h1&gt;Cache test&lt;/h1&gt; &lt;p id="rndout" runat="server"&gt;&lt;/p&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Example code behind:</p> <pre class="lang-vb prettyprint-override"><code>Partial Class ct Inherits System.Web.UI.Page Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim rc As New Random() Dim rn As Integer rn = rc.Next() rndout.InnerHtml = rn.ToString Response.Cookies("sym")("hello") = "world" Response.Cookies("sym").Expires = DateTime.Now.AddDays(370) Response.Cookies("sym").Domain = Application.Get("cookieurl") End Sub End Class </code></pre> <p>when deployed to iis 6 or 7 this does not cache, however if i comment out the 3 Response.Cookies lines it does.</p> <p>When run up in VS it works fine both ways.</p> <p>Is there some setting in iis/web.config etc to allow outputcache while i set response.cookies. I understand the cookie content will be cached as well as it is just a part of the http response that is cached.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload