Copied to clipboard

Flag this post as spam?

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


  • lothar 25 posts 99 karma points
    Aug 05, 2013 @ 17:26
    lothar
    0

    Caching by query with urlrewriting problem

    I was following this tutorial for caching by query:

    http://www.theoutfield.net/blog/2011/02/caching-an-umbraco-macro-by-querystring-parameter

    When I access my page like this: /theme?entityId=1&themeId=2

    This gets cached by query & page and everything works fine.

     

    The problem is with url rewriting as these url's are accessed in another way like this:

        <add name="entityTheme" 
             virtualUrl="~/(.*)/(\d*)/thema/(\d*)/(.*)"
             rewriteUrlParameter="IncludeQueryStringForRewrite"
             destinationUrl="~/$1/theme?entityId=$2&amp;themeId=$3"
             ignoreCase="true" />

    With macro:

    <umbraco:macro runat="server" Alias="Theme" PageId="[@entityId],[@themeId]" />

    Without caching I get the specific content based on the query, but when I cache it it gets the content from the first page and it gets cached and every other page displays this cached one.

     

    It's as if the code recognizes the id via:

    Request.QueryString["entityId"]

    But the macro not via this:

    <umbraco:macro runat="server" Alias="Theme" PageId="[@entityId],[@themeId]" />

     

    I didn't found any information or bugs around this so I like to be confirmed if this is a bug or am I forgetting something with the url rewriting?

    BTW I'm using Umbraco 4.7.2

  • lothar 25 posts 99 karma points
    Aug 06, 2013 @ 14:02
    lothar
    100

    I've got it to work.

    To use querycaching with url rewriting I had to seperate the parameters like below and define these properties explicitly in the macro itself.

    <umbraco:macro runat="server" Alias="Theme" EntityId="[@entityId]" ThemeId="[@themeId]" />
Please Sign in or register to post replies

Write your reply to:

Draft