Error executing child request Sitecore


<!--  USE SERVER-SIDE REDIRECT FOR REQUEST ERRORS
            If true, Sitecore will use Server.Transfer instead of Response.Redirect to redirect request to service pages
            when an error occurs (item not found, access denied etc).
            Default value: false
      -->
      <setting name="RequestErrors.UseServerSideRedirect" value="true"/>

Sitecore uses HttpContext.Current.Server.Transfer instead of HttpContext.Current.Server.TransferRequest so if you have UseServerSideRedirect set to “true” then you’ll get the error below to fix this please do the following:

    <!--configure IIS to redirect error page for non-ASP.NET requests-->
    <httpErrors errorMode="Custom">
      <remove statusCode="401" />
      <error statusCode="401" prefixLanguageFilePath="" path="/401" responseMode="ExecuteURL" />
      <remove statusCode="403" />
      <error statusCode="403" prefixLanguageFilePath="" path="/403" responseMode="ExecuteURL" />
      <remove statusCode="404" />
      <error statusCode="404" prefixLanguageFilePath="" path="/404" responseMode="ExecuteURL" />
      <remove statusCode="500" />
      <error statusCode="500" prefixLanguageFilePath="" path="/500" responseMode="ExecuteURL" />
      <remove statusCode="503" />
      <error statusCode="503" prefixLanguageFilePath="" path="/503" responseMode="ExecuteURL" />
    </httpErrors>
    <customErrors mode="RemoteOnly" redirectMode="ResponseRewrite" defaultRedirect="/errorPage">
      <error statusCode="401" redirect="/401" />
      <error statusCode="403" redirect="/403" />
      <error statusCode="404" redirect="/404" />
      <error statusCode="500" redirect="/500" />
      <error statusCode="503" redirect="/503" />
    </customErrors>
       <!--  ITEM NOT FOUND HANDLER
            Url of page handling 'Item not found' errors
      -->
      <!--<setting name="ItemNotFoundUrl" value="/sitecore/service/notfound.aspx"/>-->
      <setting name="ItemNotFoundUrl" value="/404"/>
  <!--  LINK ITEM NOT FOUND HANDLER
            Url of page handling 'Link item not found' errors
      -->
      <!--<setting name="LinkItemNotFoundUrl" value="/sitecore/service/notfound.aspx"/>-->
      <setting name="LinkItemNotFoundUrl" value="/404" />
namespace Helper.HttpRequestHelper
{
    using System.Web;
    using Sitecore.Configuration;
    using Sitecore.Web;

    /// <summary>
    /// ExecuteRequest
    /// </summary>
    public class ExecuteRequest : Sitecore.Pipelines.HttpRequest.ExecuteRequest
    {

        /// <summary>
        /// Redirects request to the specified URL.
        /// </summary>
        /// <param name="url">The URL.</param>
        protected override void PerformRedirect(string url)
        {
            if (Settings.RequestErrors.UseServerSideRedirect)
                HttpContext.Current.Server.TransferRequest(url);
            else
                WebUtil.Redirect(url, false);
        }
    }
}

namespace Helper.HttpRequestHelper
{
    using System.Web;
    using Sitecore;
    using Sitecore.Configuration;
    using Sitecore.Diagnostics;
    using Sitecore.Resources.Media;
    using Sitecore.SecurityModel;

    /// <summary>
    ///  MediaRequestHandler
    /// </summary>
    public class MediaRequestHandler : Sitecore.Resources.Media.MediaRequestHandler
    {
        /// <summary>
        /// Performs the actual request processing.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns>
        /// The do process request.
        /// </returns>
        protected override bool DoProcessRequest(HttpContext context)
        {
            Assert.ArgumentNotNull(context, "context");

            Sitecore.Resources.Media.MediaRequest request = MediaManager.ParseMediaRequest(context.Request);

            if (request == null)
                return false;

            Media media = MediaManager.GetMedia(request.MediaUri);

            if (media != null)
                return DoProcessRequest(context, request, media);

            using (new SecurityDisabler())
                media = MediaManager.GetMedia(request.MediaUri);

            string str;

            if (media == null)
            {
                str = Settings.ItemNotFoundUrl;
            }
            else
            {
                Assert.IsNotNull(Context.Site, "site");
                str = Context.Site.LoginPage != string.Empty ? Context.Site.LoginPage : Settings.NoAccessUrl;
            }
            if (Settings.RequestErrors.UseServerSideRedirect)
                HttpContext.Current.Server.TransferRequest(str);
            else
                HttpContext.Current.Response.Redirect(str);
            return true;
        }
    }
}
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <httpRequestBegin>
        <processor type="Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel">
          <patch:attribute name="type">Helper.HttpRequestHelper.ExecuteRequest, CoreLibrary</patch:attribute>
        </processor>
      </httpRequestBegin>
    </pipelines>
  </sitecore>
</configuration>
    <httpHandlers>
      <add verb="*" path="sitecore_webDAV.ashx" type="Sitecore.Resources.Media.WebDAVMediaRequestHandler, Sitecore.Kernel" />
      <add verb="*" path="sitecore_media.ashx" type="Helper.HttpRequestHelper.MediaRequestHandler, CoreLibrary" />
      <!--<add verb="*" path="sitecore_media.ashx" type="Sitecore.Resources.Media.MediaRequestHandler, Sitecore.Kernel" />-->
      <add verb="*" path="sitecore_xaml.ashx" type="Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory, Sitecore.Kernel" />
      <add verb="*" path="sitecore_icon.ashx" type="Sitecore.Resources.IconRequestHandler, Sitecore.Kernel" />
      <add verb="*" path="sitecore_feed.ashx" type="Sitecore.Shell.Feeds.FeedRequestHandler, Sitecore.Kernel" />
      <add verb="*" path="sitecore_handlers.ashx" type="Sitecore.Web.CustomHandlerFactory, Sitecore.Kernel" />
      <add verb="*" path="sitecore_device_simulation.ashx" type="Sitecore.Shell.DeviceSimulation.SimulationRequestHandler, Sitecore.Kernel" />
      <add verb="*" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
      <add verb="*" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
      <add verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
      <add verb="*" path="sitecore_speak.ashx" type="Sitecore.Resources.Scripts.ScriptHandler, Sitecore.Speak.Client" />
      <add name="CaptchaImage" verb="*" path="CaptchaImage.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
      <add name="CaptchaAudio" verb="*" path="CaptchaAudio.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
    </httpHandlers>

    <handlers>
      <add name="WebDAVRoot" path="*" verb="OPTIONS,PROPFIND" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
      <add name="WebDAVRoot64" path="*" verb="OPTIONS,PROPFIND" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
      <add verb="*" path="sitecore_webDAV.ashx" type="Sitecore.Resources.Media.WebDAVMediaRequestHandler, Sitecore.Kernel" name="Sitecore.WebDAVMediaRequestHandler" />
      <add verb="*" path="sitecore_media.ashx" type="Helper.HttpRequestHelper.MediaRequestHandler, CoreLibrary" name="Sitecore.MediaRequestHandler" />
      <!--<add verb="*" path="sitecore_media.ashx" type="Sitecore.Resources.Media.MediaRequestHandler, Sitecore.Kernel" name="Sitecore.MediaRequestHandler" />-->
      <add verb="*" path="sitecore_xaml.ashx" type="Sitecore.Web.UI.XamlSharp.Xaml.XamlPageHandlerFactory, Sitecore.Kernel" name="Sitecore.XamlPageRequestHandler" />
      <add verb="*" path="sitecore_icon.ashx" type="Sitecore.Resources.IconRequestHandler, Sitecore.Kernel" name="Sitecore.IconRequestHandler" />
      <add verb="*" path="sitecore_feed.ashx" type="Sitecore.Shell.Feeds.FeedRequestHandler, Sitecore.Kernel" name="Sitecore.FeedRequestHandler" />
      <add verb="*" path="sitecore_handlers.ashx" type="Sitecore.Web.CustomHandlerFactory, Sitecore.Kernel" name="Sitecore.GenericHandler" />
      <add verb="*" path="sitecore_device_simulation.ashx" type="Sitecore.Shell.DeviceSimulation.SimulationRequestHandler, Sitecore.Kernel" name="Sitecore.SimulationRequestHandler" />
      <add name="Telerik_Web_UI_DialogHandler_aspx" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" />
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" />
      <add name="Telerik_Web_UI_WebResource_axd" verb="*" preCondition="integratedMode" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" />
      <add verb="*" name="Sitecore.SpeakJS64" path="*/speak/v1/*/*.js" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
      <add verb="*" name="Sitecore.SpeakJS32" path="*/speak/v1/*/*.js" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
      <add verb="*" name="Sitecore.SpeakClassic64" path="sitecore_speak.ashx" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
      <add verb="*" name="Sitecore.SpeakClassic32" path="sitecore_speak.ashx" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
      <add verb="*" path="sitecore_speak.ashx" type="Sitecore.Resources.Scripts.ScriptHandler, Sitecore.Speak.Client" name="Sitecore.Speak" />
      <add name="CaptchaImage" verb="*" path="CaptchaImage.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
      <add name="CaptchaAudio" verb="*" path="CaptchaAudio.axd" type="Sitecore.Form.Core.Pipeline.RequestProcessor.CaptchaResolver, Sitecore.Forms.Core" />
      <add name="MSCaptcha" verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha" />
    </handlers>

Server Error in '/' Application.

<h2><i>Error executing child request for /404 .</i></h2>
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.</span>

Exception Details: </b>System.Web.HttpException: Error executing child request for /404.

<code> An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code></td>

<b>Stack Trace:</b></span>

<pre>[HttpException (0x80004005): Error executing child request for /404.]
System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +2684
System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +1273
System.Web.HttpServerUtility.Transfer(String path) +146
Sitecore.Pipelines.HttpRequest.ExecuteRequest.HandleItemNotFound(HttpRequestArgs args) +566
(Object , Object[] ) +83
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +365
Sitecore.Nexus.Web.HttpModule.(Object , EventArgs ) +457
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
</pre>

Advertisements

One thought on “Error executing child request Sitecore

  1. Where’s the section httpHandlers?? i’ve found the handlers section but i can’t find the other one…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s