This project is read-only.

mdo:setup-output-cache(seconds, location)

Setups caching for complete ASP.NET page

<xsl:execute select="mdo:setup-output-cache(10, 'Server')" />

Setting up output caching

1. Setting up web.config

You have to add something like that into your web.config

      <outputCache enableOutputCache = "true" enableFragmentCache = "true" sendCacheControlHeader = "true" />

2. Setting up Global.asax

XsltDb output caching requires some code to be added to your Global.asax file

<%@ Application Language="C#" Inherits="DotNetNuke.Common.Global" %>

<script runat="server">
public override string GetVaryByCustomString(HttpContext context, string arg)
    if (arg == "XsltDbStar")
        StringBuilder sb = new StringBuilder();
        HttpCookie c = HttpContext.Current.Request.Cookies[".DOTNETNUKE"];
        if (c != null)
        string language = HttpContext.Current.Request["language"];
        if ( string.IsNullOrEmpty(language) )
            c = HttpContext.Current.Request.Cookies["language"];
            if (c != null)
                language = c.Value;
        if ( !string.IsNullOrEmpty(language) )

        return sb.ToString();
    return base.GetVaryByCustomString(context, arg);

Note, that authentication cookie name may differ from .DOTNETNUKE, you must check web.config and use correct one.

Last edited Mar 5, 2011 at 1:32 PM by findy, version 1


No comments yet.