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!
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()
this post is old, but probably my solution will help someone: