Vulnerability in EPiServer.Forms

Try our conversational search powered by Generative AI!

Anders Hattestad
Jun 7, 2010
(0 votes)

Performance and Scalability

Was at EPiServer Partner Summit, and had the pleasure to hear Magnus Stråle talked about this subject. The key feature I think he talked about was that you have to understand that html cache don’t always need to be correct. It’s like my mother always have told me: Its ok to cheat in poker, as long as you don’t get caught.

He talked about output Page cache, and different strategies to  cache it. 

In a scenario where you have a lot of logged in users, and or a lot of forms that are being submitted there will be very few actually hits in a page cache aproce, Since the unique key pr page will need to include the userID, and a post will not use the page cache..

In some sites I have made we have used an area cache technique.  This is an approce you can use if you have areas in your page that aint depended on the UserID, or areas that actully don’t bother if the Page is in a post back mode. It could even be parts that is always the same.

There is actully easy to make your own area cache. If you make a WebControl that overrides AddParsedSubObject like this

protected override void AddParsedSubObject(object obj)
    if (IsCached() && UseCache)
and change the render method to something like this:
protected override void Render(System.Web.UI.HtmlTextWriter writer)
    if (IsCached()) 
    else if (UseCache)

Then you can retrive the content, and cache it

void WriteAndUpdateCachedValues(System.Web.UI.HtmlTextWriter writer)
    System.Web.UI.HtmlTextWriter  tmp = new System.Web.UI.HtmlTextWriter(new StringWriter());
    base.Render (tmp);
    cachedValue = tmp.InnerWriter.ToString();

Then the only thing that are needed is to have properties in the web control that sets the key you want to save your cache with. Some keys could be

public string CacheKey = "";
public bool CacheOnPageID = true;
public bool CacheOnUrlParameters = true;
public bool UseCache = true;
public bool CacheOnUserID=false;
public bool CacheOnUserRoles=true;
public bool CachePostback = false;

Then you could in your master page add this around sidebar, many, top and other elements, and set the cache properties based on your knowledge on what will change in the different parts of the page. You can then attach to the episerver datafactory events, and invalidate the different part of the cache when there is a page change.

You can’t add controls or stuff automaticly in other part of the cache area thou :)

The rest of the code is a bit more complex, so i want add it here.

Thanks for a great EPiServer Partner Summit and had a really nice time there. Was very fun to see the faces behind the blog posts :)

Jun 07, 2010


Please login to comment.
Latest blogs
Stop Managing Humans in Your CMS

Too many times, a content management system becomes a people management system. Meaning, an organization uses the CMS to manage all the information...

Deane Barker | Nov 30, 2023

A day in the life of an Optimizely Developer - Optimizely CMS 12: The advantages and considerations when exploring an upgrade

GRAHAM CARR - LEAD .NET DEVELOPER, 28 Nov 2023 In 2022, Optimizely released CMS 12 as part of its ongoing evolution of the platform to help provide...

Graham Carr | Nov 28, 2023

A day in the life of an Optimizely Developer - OptiUKNorth Meetup January 2024

It's time for another UK North Optimizely meet up! After the success of the last one, Ibrar Hussain (26) and Paul Gruffydd (Kin + Carta) will be...

Graham Carr | Nov 28, 2023

Publish content to Optimizely CMS using a custom GPT from OpenAI 🤖

Do you find the traditional editor interface complicated and cluttered? Would you like an editorial AI assistant you can chat with? You can!

Tomas Hensrud Gulla | Nov 28, 2023 | Syndicated blog

Optimizely Graph and Next.js: Building Scalable Headless Solutions

Optimizely Graph harnesses the capabilities of GraphQL, an intuitive and efficient query language to, transform content within an Optimizely CMS in...

Szymon Uryga | Nov 27, 2023

Getting Started with Optimizely SaaS Core and Next.js Integration: Testing Content Updates

The blog post discusses the challenges of content updates on a website using Optimizely CMS, Next.js, and the Apollo Client due to Apollo's local...

Francisco Quintanilla | Nov 27, 2023 | Syndicated blog