Microsoft Content Management Server - Caching via GetVaryByCustomStringToken

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > November 2007 > Caching via GetVaryByCustomStringToken





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Caching via GetVaryByCustomStringToken
Rob Janssen

2007-11-13, 7:25 am

Hello,

At this moment I'm setting up our MCMS site with caching.
I used an example from: Building Websites with MCMS2002.

In the global.asax I've added the following section:

protected override string GetVaryByCustomStringToken(HttpContext context,
string token)
{
if (token.ToLower() == "cmschannel")
return CmsHttpContext.Current.Channel.Guid;
else
return base. GetVaryByCustomStringToken(context,token
);
}

In our navigator I use :
<%@ OutputCache Duration="300" VaryByParam="None"
VaryByCustom="CMSChannel;CMSControl" %>

Now I discovered a problem in de global.asax. Everytime as the token is
cmschannel, the CmsHttpContext.Current.Channel is null.

Could someone give me advise how to solve this issue??

Kind Regards,

Rob Janssen.
Stefan Goßner [MSFT]

2007-11-13, 7:25 am

Hi Rob,

I haven't seen this.
Is it possible that this control is being used on a normal ASPX page rather
than a channel rendering script or a template?

Cheers,
Stefan


"Rob Janssen" <Rob Janssen@discussions.microsoft.com> wrote in message
news:8EA3DB2F-0F82-446E-A652-2724E185F8EA@microsoft.com...
> Hello,
>
> At this moment I'm setting up our MCMS site with caching.
> I used an example from: Building Websites with MCMS2002.
>
> In the global.asax I've added the following section:
>
> protected override string GetVaryByCustomStringToken(HttpContext context,
> string token)
> {
> if (token.ToLower() == "cmschannel")
> return CmsHttpContext.Current.Channel.Guid;
> else
> return base. GetVaryByCustomStringToken(context,token
);
> }
>
> In our navigator I use :
> <%@ OutputCache Duration="300" VaryByParam="None"
> VaryByCustom="CMSChannel;CMSControl" %>
>
> Now I discovered a problem in de global.asax. Everytime as the token is
> cmschannel, the CmsHttpContext.Current.Channel is null.
>
> Could someone give me advise how to solve this issue??
>
> Kind Regards,
>
> Rob Janssen.



Rob Janssen

2007-11-13, 7:25 am

That's correct Stefan,

It's a normal aspx page.

Rob

"Stefan Goßner [MSFT]" wrote:

> Hi Rob,
>
> I haven't seen this.
> Is it possible that this control is being used on a normal ASPX page rather
> than a channel rendering script or a template?
>
> Cheers,
> Stefan
>
>
> "Rob Janssen" <Rob Janssen@discussions.microsoft.com> wrote in message
> news:8EA3DB2F-0F82-446E-A652-2724E185F8EA@microsoft.com...
>
>
>

Stefan Goßner [MSFT]

2007-11-13, 1:23 pm

Hi Rob,

then this is as expected!
ASPX pages do not live in a channel - so there is no current channel
available.

Cheers,
Stefan


"Rob Janssen" <RobJanssen@discussions.microsoft.com> wrote in message
news:E69D61D8-AC77-4A73-9098-580647132654@microsoft.com...[vbcol=seagreen]
> That's correct Stefan,
>
> It's a normal aspx page.
>
> Rob
>
> "Stefan Goßner [MSFT]" wrote:
>


Rob Janssen

2007-11-13, 1:23 pm

oke, I will add the aspx as a template an will try it again.

"Stefan Goßner [MSFT]" wrote:

> Hi Rob,
>
> then this is as expected!
> ASPX pages do not live in a channel - so there is no current channel
> available.
>
> Cheers,
> Stefan
>
>
> "Rob Janssen" <RobJanssen@discussions.microsoft.com> wrote in message
> news:E69D61D8-AC77-4A73-9098-580647132654@microsoft.com...
>
>
>

George Leithead

2007-11-14, 7:26 am

On 13 Nov, 13:42, Rob Janssen <RobJans...@discussions.microsoft.com>
wrote:
> oke, I will add the aspx as a template an will try it again.
>
>
>
> "Stefan Go=DFner [MSFT]" wrote:
>
>
>
>
>
>
>
>
>
>
ge[vbcol=seagreen]
>
>
>
>
>
en is[vbcol=seagreen]
>
>
>
>
> - Show quoted text -


I have something similar. Simply create a MCMS Template with no
placeholders, and have as the source the ASPX page. Works a treat!

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com