B
B
Hi,
I'm working on a site where the user must log in before they see the
home page.
When the user logs in, I retrieve their role from the database, store
it in a Session object and redirect to the homepage. The home page
contains a navigation menu (user control) which displays links
available to the user based on their role. The navigation menu/links
are generated from the database.
To minimize database calls, once the user logs in I'd like to
effectively cache the navigation menu user control for the duration of
that user's session. Does anyone have any idea how to do this?
I've had a look at setting Duration on @OutputCache but this causes
problems if a user logs out, and another user logs in with a different
role: the new user sees the old user's navigation menu.
Would Application level variables be more appropriate in this
situation? I have to say that I don't have much experience of caching
in ASP.NET so any help would be appreciated.
Thanks,
B
I'm working on a site where the user must log in before they see the
home page.
When the user logs in, I retrieve their role from the database, store
it in a Session object and redirect to the homepage. The home page
contains a navigation menu (user control) which displays links
available to the user based on their role. The navigation menu/links
are generated from the database.
To minimize database calls, once the user logs in I'd like to
effectively cache the navigation menu user control for the duration of
that user's session. Does anyone have any idea how to do this?
I've had a look at setting Duration on @OutputCache but this causes
problems if a user logs out, and another user logs in with a different
role: the new user sees the old user's navigation menu.
Would Application level variables be more appropriate in this
situation? I have to say that I don't have much experience of caching
in ASP.NET so any help would be appreciated.
Thanks,
B