Accessing UmbracoHelper in HttpHandler request

Working with UmbracoHelper and IPublishedContent in HttpHandler

If you were planning to create sitemap.xml in Umbraco, you most probably were doing it with HttpHandler. This was fine until Umbraco version 6.2.2.

If your website was running in lower version, most probably after update your HttpHandler were crashing since UmbracoContext.Current returns null.

However, there is a workaround for this. You need to initialize UmbracoContext on ProcessRequest of your HtppHandler as a first thing.

        public void ProcessRequest(HttpContext context)
                new HttpContextWrapper(HttpContext.Current),

            //The rest of your code

This simple fix should allow you accessing UmbracoHelper methods and published Umbraco context from App_Data/umbraco.config


Purpose of the code contained in snippets or available for download in this article is solely for learning and demo purposes. Author will not be held responsible for any failure or damages caused due to any other usage.

About the author


Dejan is a passionate Software Architect/Developer. He is highly experienced in .NET programming platform including ASP.NET MVC and WebApi. He likes working on new technologies and exciting challenging projects

CONNECT WITH DEJAN  Loginlinkedin Logintwitter Logingoogleplus Logingoogleplus


read more


read more


read more


read more

Comments for this article