Understanding Page Caching

J

Jonathan Wood

I have a question about caching a page.

What if my master page displays information specific to the current user?
For example, I will create a navigation menu that is different, depending on
the role of the current user.

Does that mean users will see the menu for other users if the page is cached
instead of being recreated?

Thanks for any tips.
 
B

Barrie Wilson

Jonathan Wood said:
I have a question about caching a page.

What if my master page displays information specific to the current user?
For example, I will create a navigation menu that is different, depending
on the role of the current user.
Does that mean users will see the menu for other users if the page is
cached instead of being recreated?

no, not at all ... IF you use the varyByParam, varyByControl or varyByCustom
properties you can circumvent that entirely ... needless to say, the more
cache variations you have to create, the more you defeat the purpose of
caching

if you have two scenarios:

page1.aspx?userType=honcho
page1.aspx?userType=plebe

and your cache directive is:

<%@ OutputCache Duration="120" VaryByParam="userType" %>

you should have efficient and effective caching; only two variants of
page1.aspx have to be cached ...

on the other hand, if you have:

page1.aspx?userID=101000111883
coupled with
<%@ OutputCache Duration="120" VaryByParam="userID" %>

you can see the problem ....
 
J

Jonathan Wood

Barrie,
on the other hand, if you have:

page1.aspx?userID=101000111883
coupled with
<%@ OutputCache Duration="120" VaryByParam="userID" %>

you can see the problem ....

Right. And with a site that displays dynamically generated content including
different themes for different user groups, I can see this would become
quite messy.

Most pages in the site I'm developing will contain content tailored to the
current user. So now I'm thinking I shouldn't even both with caching. It
would be catastrophic to display one user's data to a different user.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,614
Members
45,287
Latest member
Helenfem

Latest Threads

Top