Output Cache Per User?

M

Mark

Output caching is a wonderful thing - but it apparently makes no
distinctions among users. What would be good way to output cache a page per
user? In my ASP.NET Web application authenticated users see things
differently than unauthenticated users. I'd like to be able to cache the
pages so that the different user types see output only relevant to their
security access level.

Any ideas?

Thanks.
 
C

Cowboy

Create a property for the type of user and cache based on this property.
Very easy for user controls, a bit harder for pages.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 
S

Scott Mitchell [MVP]

Mark said:
Output caching is a wonderful thing - but it apparently makes no
distinctions among users. What would be good way to output cache a page per
user? In my ASP.NET Web application authenticated users see things
differently than unauthenticated users. I'd like to be able to cache the
pages so that the different user types see output only relevant to their
security access level.

Mark, you can vary the output cache by a custom value using
VaryByCustom. Check out this article:

Page Output Caching, Part 1
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp03282002.asp

Specifically pay attention to Custom Variation: Overriding VaryByCustom
section. (Of course, I'd advise you to read the entire article, as it's
very informative.) :)

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 

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,780
Messages
2,569,611
Members
45,270
Latest member
TopCryptoTwitterChannels_

Latest Threads

Top