Caching user controls - problem with multiple users?

J

Justice Gray

The background to my problem:

I have constructed a small web application. Each page of that web
application contains a small user control I made, that has three sections:

1) imgCompany (of type ImageButton)
My company's logo

2) imgCustomer (of type ImageButton)
The customer company's logo. The ImageUrl property changes according to the
user that is logged in...i.e. if customer is from Company A then Company A's
logo is displayed. If customer is from Company B then Company B's logo is
displayed, and so on.

3) A set of menu options that show and hide themselves according to the
prev. permissions of the user that logged in.

This needs to be shared across all pages in the site.

I thought that setting my @OutputCache directives to the following:
Directive="500"
VaryByControl="imgCustomer"
Shared="true"

would solve my difficulty.


However, in testing situtations, this is what happens:

Customer A logs in. Sees the header appropriate for Customer A. Header is
stored in cache.

Customer B logs in. Sees the header appropriate for Customer *A* (loaded
from cache).

Obviously, I want to cache each instance of the User Control that has a
different setting for imgCustomer.ImageUrl, such that Customer A will see
logo A, and customer B will see logo B. What have I done in error?

Any help would be *greatly* appreciated!

-Justice
 

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

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top