By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,972 Members | 883 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,972 IT Pros & Developers. It's quick & easy.

Problems with OutputCache declaration in User Control

P: n/a
I have the following scenario:

I have a user control that contains a registered menu control. The menu and
other information on the user control is specific to the user accessing the
site. This user control is used on many pages. In order to create this
control, I need to access information in the Active Directory to create both
the menu and other info displayed on the control.

This access takes some time and I wanted to cache this info the first time
the control is accessed and save it for access to additional pages with the
control, to speed things up. I was originally looking at cache namespace but
from what I understand, this caching is more for application wide issues.
This data is user specific (session specific).

I have been trying to use the <%@ OutputCache ......... %> declaration on
the user control page. But it has trouble after the first access (when
accessing cache), getting a unknown object error. The menu is registered to
the page. I read about the following issue that may be similar (someone
accessing a javascript ‘page’ declarative):

Since the control is loaded from cache there is no way that the code will
load as well since it's in a different container: the page instead of the
user control.

The suggestion was to put the script block inside the user control's
container.

If this can be done, how is this done? If not, does anyone having
suggestions on obtaining the results I want even if doesn't entail using the
OutputCache declarative.

Thanks,
Barbara Alderton
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
I decided to drop the <%@ OutputCache ......... %> usage.

Instead I retrieve the information at Session_start and store in an
arraylist of records (class definition). Then in the user control I access
the data in the arraylist to build the menu. Speeds things up dramatically.

Barbara Alderton

"Barbara Alderton" wrote:
I have the following scenario:

I have a user control that contains a registered menu control. The menu and
other information on the user control is specific to the user accessing the
site. This user control is used on many pages. In order to create this
control, I need to access information in the Active Directory to create both
the menu and other info displayed on the control.

This access takes some time and I wanted to cache this info the first time
the control is accessed and save it for access to additional pages with the
control, to speed things up. I was originally looking at cache namespace but
from what I understand, this caching is more for application wide issues.
This data is user specific (session specific).

I have been trying to use the <%@ OutputCache ......... %> declaration on
the user control page. But it has trouble after the first access (when
accessing cache), getting a unknown object error. The menu is registered to
the page. I read about the following issue that may be similar (someone
accessing a javascript ‘page’ declarative):

Since the control is loaded from cache there is no way that the code will
load as well since it's in a different container: the page instead of the
user control.

The suggestion was to put the script block inside the user control's
container.

If this can be done, how is this done? If not, does anyone having
suggestions on obtaining the results I want even if doesn't entail using the
OutputCache declarative.

Thanks,
Barbara Alderton

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.