Hi,
I have written a user control that generates a menu depending on the
type of user that has logged in to my site. The information about the
user is stored in a cookie.
The control works great, but now I want it to be cached as it will
always be the same for a particular user group. So I tried adding an
OutputCache directive to the control with VaryByParam = "none". So far
so good. It gets displayed right on the first request, but once it
gets cached, it never shows up again. I've written all the code to
generate the menu within the Page_Load event of the control.
Obviously, that doesn't run until the cache expires.
What is the correct approach to cache the control so that it gets
displayed all the time, but is retrieved from the cache? How would I
use VaryByParam when I'm not using any values from querystring or a
form POST? All my variables are in the cookie.
Thanks in advance.
Saurabh Nandu - 12 Jul 2004 08:32 GMT
Hi,
I think you will have to implement Custom Caching, and then write appropriate code to ensure you look up the cookie to change the different cache copies.
Following links from the .NET SDK should help you do that.
[ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconcachingversionsofpagebasedoncustomstrings.htm]
[ ms-help://MS.NETFrameworkSDKv1.1/cpgenref/html/cpconoutputcache.htm ]
look at the VaryByCustom property

Signature
Regards,
Saurabh Nandu
Master C#, the easy way...
[ www.MasterCSharp.com ]
> Hi,
>
[quoted text clipped - 16 lines]
>
> Thanks in advance.