简体   繁体   中英

Exclude Dynamic Rendered User Control From Output Caching

We have a site (actually an Application Builder) that rendered a lot of user controls in different scenarios,

One day the manager decided to add Output cache in the main page,

OK, every things is fine and the request responded very fast!

But in the other hand this caching have some troubles:

Assume we have an InsertForm User control that filled some entities, and a ListForm User Control that display list of entities, So you can guess what happen, the entities filled correctly but not shown in List, why? because of output caching.

Then we must exclude this user controls from caching, after some search we find Donut Caching , and it seems very well,

We use Add dynamically server control to Substitution

Most of user controls implementations depend of all page life cycle, some of them do in Init , some in Load some of them in Render , so in most scenarios we have a place holder, what we do is:

在此输入图像描述

在此输入图像描述

And in PreRender remove all controls from placeHolder to prevent of duplication:

在此输入图像描述

in some cases we have a good result But in some implementation again we have troubles, all of the Request replaced with HttpContext.Current.Request and all of the Session s converted to fields, but in some cases like use Wizard we still have exception: Request does not exist in this context . And in bind events we have troubles again, the events not bind correctly, like the wizard next button click event.

After all I fill we are in wrong way, maybe this is not practical in this scenario,

what do you think?

do we have another option?

or all of this troubles are solvable? any suggestion please?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM