Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Harry Kakoulidis 17 posts 40 karma points
    Feb 15, 2011 @ 07:38
    Harry Kakoulidis
    0

    Different behavior than expected from umbraco.tv tutorial on macro caching

    Hi! I'm following the Macro Caching video in umbraco.tv and recreated the example in it.

    -------html--------- 
    <p>
       
    <% = System.DateTime.Now.ToString("G") %>
    </p>
    <p>
        <asp:Literal ID="Dt" runat="server" /
    >
    </p>

    ---- c# ----------
    protected void Page_Load(object sender, EventArgs e)
    {
       
    Dt.Text = DateTime.Now.ToString("G");

    This works ok without caching in the Macro. But if I enable caching:

    • The first time it runs it's ok
    • But on cached output, the output of the codebehind (The literal control's text) is not cached, so in the next refresh the literal gets replaced with it's default value (null string)
    • Also on each reload, the following is not updated, but the time of the original usercontrol creation time is shown:
      <% = System.DateTime.Now.ToString("G") %>

    But watching the video in umbraco.tv, the video seems to suggest that on each refresh, the

    <% = System.DateTime.Now.ToString("G") %>

    should be replaced with the current time regardless whether caching was used or not, and also the value in Dt created by code the first time should be displayed. What am I doing wrong here? Using 4.6.1. Thanks!

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Feb 15, 2011 @ 07:57
    Peter Gregory
    1

    Hi Harry

    This is a known bug in 4.6.1 and is being fixed for the 4.6.2 release. 

    Thanks

    Peter Gregory

Please Sign in or register to post replies

Write your reply to:

Draft