How To Improve DotNetNuke Performance (IHttpModule Far Future Expire Static Content)

There are a lot of articles regarding how to boost DotNetNuke performance out there. This article just only add a little spot to the horizon.

The idea is to give far future expiration header to the all static contents. The process of adding expiration was done through the httpresponse using IHttpModule class implementation.

below are the steps taken:

1. create class implementation project using visual studio

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Web;

namespace ISM.HTTPModuleFarFutureExpireHeader
public class Expire : IHttpModule
public void Dispose() { }

public void Init(HttpApplication context)
context.BeginRequest += new EventHandler(context_BeginRequest);

void context_BeginRequest(object sender, EventArgs e)
HttpContext context = HttpContext.Current;

string url = context.Request.Url.ToString();

if (url.Contains(“/Portals/”))
context.Response.Cache.SetMaxAge(TimeSpan.FromDays(365.0 * 3.0));


2. build the project and then put the resulting dll into the BIN folder


3. edit web.config file and register the HttpModule

<add name=”FarFutureExpiration” type=”ISM.HTTPModuleFarFutureExpireHeader.Expire, ISM.HTTPModuleFarFutureExpireHeader” />

4. done


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s