Exclude dynamic visualized user control from output caching

We have a website (actually Application Builder) that displays many user controls in different scenarios,

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

OK, everything is fine, and the request was answered very quickly!

But on the other hand, this caching has some problems:

Suppose we have an InsertForm User control that populated some entities, and a ListForm User Control that displays a list of objects. So, you can guess what will happen, the objects filled in correctly, but not shown in the list, why? due to output caching.

Then we need to exclude this user control from caching, after some search we find Donut Caching , and it seems very good,

We use Add dynamically server control to the substitution

Most implementations of user controls depend on the entire life cycle of the page, some of them are executed in Init , some of them are in Download , some of them are in Render >, so in most scenarios we have a place that we do:

enter image description here

enter image description here

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

enter image description here

In some cases, we have a good result. But in some implementation problems arise again, all Request replaced by HttpContext.Current.Request and all Session converted to fields, but in some cases, for example, using Wizard We still have an exception: Request does not exist in this context . And in the binding events problems again arise, the events are not connected correctly, for example, the next time you click the wizard button.

After filling in, I’m wrong, maybe it’s not practical in this scenario,

What do you think?

Do we have another option?

Or are all these problems solvable? any suggestion please?

+4
source share

Source: https://habr.com/ru/post/1483170/


All Articles