So I decided to update my blog engine to the newest version and along with that I wrote a simple extension to detect IE6 users and redirect them to a non-supported browser page. Not that my theme cannot handle IE6 but I feel I should get on board and help as much as I can with the movement to rid the internet of this outdated browser.
The extension is pretty simple and uses the built in Response.Browser object which should work for IE6 nicely. To make an extension for BlogEngine is pretty easy just create a class with a constructor with no parameters and then wire up one or more events that the BlogEngine raises to your event in your extension class. Below is my extension class for the redirect logic.
[Extension("Redirects users with non-supported browsers to an alternate download page", "1.0", "thefrozencoder.ca")]
public class NonSupportedBrowser
Post.Serving += new EventHandler(ServingHandler);
Page.Serving += new EventHandler(ServingHandler);
void ServingHandler(object sender, ServingEventArgs e)
HttpContext context = HttpContext.Current;
if (context != null && !context.Items.Contains("NonSupportedBrowserTest"))
System.Web.UI.Page page = context.CurrentHandler as System.Web.UI.Page;
if (page != null)
if (context.Request.Browser.MajorVersion <= 6 && context.Request.Browser.Browser.Equals("IE"))
string file = System.Configuration.ConfigurationManager.AppSettings["NonSupportedBrowser"];
As you can see in the constructor I wire up the Page.Serving and Post.Serving events to my own method. I create a context item (NonSupportedBrowserTest) and check for it because the event will be called more than once in the lifetime of the request. I also store the file name in an appSettings key/value so I can change the file to be redirected to (simple HTML file in this case). All that is required is to place the code file in the App_Code\Extensions folder and add the HTML file with the instructions to download a newer browser.
If you are looking for some ideas for this page I simply used the code from the IE6 No More website.