November Happy Hour will be moved to Thursday December 5th.

Server.Transfer till EPi aspx

Vote:
 
Jag försöker göra en Server.Transfer till en sida som ärver från EPiServer.TemplatePage (och som ligger i samma applikation), men jag får ett exception "Error executing child request for...aspx". Om jag däremot gör en Server.Transfer till en sida som ärver från System.Web.UI.Page så går det utmärkt. Anledningen till att jag vill göra en Server.Transfer istället för en Response.Redirect är att det handlar om en 404-sida. Gör jag en redirect så blir problemet att sökmotorer tolkar resultatet som ett 302 page found.
#24096
Sep 24, 2008 10:24
Vote:
 

First here an english translation of the question:

===========================================
I'm trying to make a Server.Transfer to a page that inherits from EPiServer.TemplatePage (and who is in the same application), but I get an exception "Error executing child request for ... aspx". If, however, I do a Server.Transfer to a page that inherits from System.Web.UI.Page that is the ideal. The reason I want to make a Server.Transfer instead of a Response.Redirect is that it is a 404-page. I make a redirect so the problem is that search engines interpret the outcome as a 302 page found.
===========================================

It is hard to tell what your exact problem is without seeing the full error, but I have done this a number of times, and usually the problem is that EPiServer by default does a validation that the page template matches the requested page. In version 5 this is controled by the pageValidateTemplate setting, in version 4 by the EPfValidatePageTemplate appsetting. Setting these to false is the easiest way to solve this problem, however a better way is to override the ValidatePageTemplate() method on you error page and skip the validation if the page is processed after a server transfer.

Hope that this solves your problem!

Henrik Nystrom

#24129
Sep 25, 2008 2:53
Vote:
 

Thanks for the post!

 I still having problem though, in web.config the setting is "pageValidateTemplate=false", so that is not the case. This is the stacktrace:

 System.Web.HttpException was unhandled by user code
  Message="Error executing child request for /Templates/Public/Pages/Crisis.aspx."
  Source="System.Web"
  ErrorCode=-2147467259
  StackTrace:
       at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
       at System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm)
       at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
       at KnowIT.core.HttpModules.HttpErrorModule.Context_Error(Object sender, EventArgs e) in C:\Inetpub\websites\name\wwwroot\core\HttpModules\HttpErrorModule.cs:line 39
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Web.HttpApplication.RaiseOnError()

#24148
Edited, Sep 25, 2008 13:56
Vote:
 

this post is old, but probably my solution will help someone:

http://world.episerver.com/Blogs/Gatis-Bergspics/Dates/2011/9/ServerTransfer-issue-Error-executing-child-request-for-404/

#53939
Sep 26, 2011 21:23
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.