More Stuff
to go Faster

Oct 08


This post continues a collection of ideas and options for you to pick from to help your Sitefinity projects run faster. Some are actualy Sitefinity specific. Some are for when developing. Some are for production. Most can be applied to any website. This post is a varity of bits and bobs.

Visual Studio - Diagnostic tools

A cool tool but I am only interested in it now and then. Speed up your development time by disabling this by default. Turn it on when you want to study it.

Disable diagnostic tools

Warmup module

Disable this in your local development environments. Sitefinity can take its time to start and if I am working on one page, I don't really need 40 others being pre-rendered.


Just for completeness really but I am sure you are removing debug='true' in your web.config files outside of your development. You need it when developing but it adds 30% processing overhead.

You should be doing a release build for your deployments. There isn't a massive performance gain but there are some optimisations the compiler will do verses the debug build and it is recommended by Microsoft.

Dynamic Compression Before Cache

By default, this value is set to false in your web.config.

<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="false" />

Setting this to true is considered a better approach.

By setting this to true the following happens. When a page is first requested and it is being compiled and put into the output cache, any further requests will wait for the cached version of that page rather than starting a second request and repeating what the first request is currently doing.

So why is it set to false to start with? It sounds the better way to go. Setting it to true can cause errors when the response is modified on its return.

The ASP.NET Web Forms Cache Subsitituion causes such an error. The Sitefinity Web Forms Login Status widget uses cache subsitution and will throw an error if this attribute is set to true. If you are not using this widget and not using Cache Subsittution in your code, (you should change it if you are) then set this value to true for better performance.

Trim The Response Header

One security goal is to remove as much identifying data about your site as possible. Its minor stuff. Just because you remove the IIS version from the header doesn't make it impossible for someone to work out what version of IIS you are using. But it does make it more work and it does reduce the size of the header sent and so a performance gain.

Removing the server header is done in the End Request event.

Server: Microsoft-IIS/8.0
protected void Application_EndRequest()

Remove the MVC response header in the Application Start method.

X-AspNetMvc-Version: 5.0
MvcHandler.DisableMvcResponseHeader = true;

Remove ASP.NET identifier via the web.config file.

X-AspNet-Version: 4.0.30319
<httpRuntime targetFramework="4.7.2" enableVersionHeader="false" />

Also in the web.config, you can remove the X-Powered-By.

X-Powered-By: ASP.NET
		<remove name="X-Powered-By" />
Reindex Your Database

Your database can become fragmented over time and this will slow overall performance. Look to rebuild the indexes on regular basis.

Remove Extra View Engine Lookups

MVC has many view engines and by default loads alternative ones such as WebForms. When it goes looking for a view it searches several locations and all the view type extensions. If you are confident you will not be using .aspx and .ascx views or their VB cousins remove them and the time to look for them.

In the Application Start method.

ViewEngines.Engines.Add(new RazorViewEngine());

The Razor view engine will also include looking up .vbhtml files. You can also take it a step further by customising your own view and only having it lookup .cshtml. Assuming that is all you plan to use. I have already written a post on a custom view engine. I am not using it today so test it out.


Make sure that the properties of your page have ViewState disabled. Most likely an issue for sites that where WebForms based and have been migrated to MVC based. It is off by default now.

Disable Session State

If you can avoid this then your pages will process faster. Often this can be left on in the web config. I always explicitly set it in my web.config as I am not sure of the default or other things that will enable it. I do know that the global methods of Session_Start and End will enable it.

<sessionState mode="Off"></sessionState>

Empty Global Methods

If you have empty methods in your Global file then they will add an event to the processing pipeline. Delete them if not used and remove that check.

If you have an empty Session method that will be worse as it will enable and add processing the session cookie for all your page requests.


When you get a collection of DataItems out of Sitefinity and you also want to get related data items from each one, before you start your for-each loop call this method on the collection. It will decrease the number of database calls by doing more upfront in the request since it knows that you are wanting related data.

var helpItems = manager.GetDataItems(Modules.Help).Skip(0).Take(50).ToList();

Azure Web App

A couple of settings to ensure are set in the configuration panel.

HTTP2 is selected, not the default of HTTP1.1.

ARR Affinity is off. When on this will add a cookie and ensure all requests go to the same server. If you don't need this then it is just overhead.

Always On is 'on'. Otherwise during no activity, like the middle of the night, the application will be unloaded to save resources.


Just because you can upload videos to Sitefinity. Don't! Use Vimeo, YouTube or some other purpose built video streaming service. IIS, ASP.NET, SQL is not designed to stream videos.

Darrin Robertson - Sitefinity Developer

Thanks for reading and feel free to comment - Darrin Robertson

If I was really helpful and you would buy me a coffee if you could, yay! You can.

Leave a comment
Load more comments

Make a Comment

recapcha code