I am adding a sitemap to my site. I created a custom route and am adding it in a pipeline processor. When I brows to the page I get the following error:

Object reference not set to an instance of an object.

[NullReferenceException: Object reference not set to an instance of an object.]  
Sitecore.Mvc.Pipelines.Request.RequestBegin.EnsureLoggedInForPreview.Process( PipelineArgs args) +30
 (Object , Object[] ) +70
 Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +468
 Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain) +21
 Sitecore.Mvc.Pipelines.PipelineService.RunPipeline(String pipelineName, TArgs args) +194
 Sitecore.Mvc.Routing.RouteHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +73  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +1122
 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +213
 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +131

Here is the pipeline:

public void Process(PipelineArgs args)
        RouteTable.Routes.MapRoute("Sitemap", "sitemap.xml",
            new { controller = "XmlSitemap", action = "XmlSitemap" });


And I am patching it in as per Sitecore's documentation:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="DD.Platform.Sc.Pipelines.Mvc.RouteConfig,DD.Platform.Sc"
               patch:after="processor[@type='Sitecore.Pipelines.Loader.EnsureAnonymousUsers, Sitecore.Kernel']" />

Its definitely something about the .xml. If I make the custom route just 'sitemap' it works.

1 Answer 1


I had to explicitly allow xml files using the Sitecore FilterUrlExtensions setting:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type='Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel'>
      <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, asp, xml</param>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.