Custom Error Page

Vote:
 
Hi! I have some problems setting up a custom error page correctly. I have turned off EPi's error handling. So everything works as I want for .aspx files. However the don't for other file types. When I change the 404-page in IIS according to this article http://www.episerver.com/templates/faq____1019.aspx some CSS-files aren't found and things look pretty fubar, mostly in edit and admin mode. I think it has something to do with what is discussed in this article: http://www.episerver.com/templates/faq.aspx?id=4112 How can I set the 404-error page to my custom page without encountering the css-problem????
#12494
Jan 11, 2006 11:14
Vote:
 
You need to have an error page that is an aspx file. Many functions in EPiServer uses the ability to catch PageNotFoundException example the Page___XXXX.aspx functionality. For that to happen the errorpage nedds to be an aspx file so that the .net framework kicks starts even for requests with no valid page. /HAXEN
#14356
Jan 11, 2006 14:37
Vote:
 
I had the 404 pointing to one of my EPI-pages, which is an aspx. This didn't work. However pointing it to a regular aspx-page, that did nothing but call Response.Redirect to the epi-page I really wanted to load, did work. Don't ask me why.
#14357
Jan 11, 2006 16:01
Vote:
 
Just make sure your 404 design and implementation is clean and functional. You do not want to end up in a endless 404 loop. Additionally, EPiServer will throw an PageNotFoundException if you specify an invalid id, which will not be redirected to your 404 handler. /Steve
#14358
Jan 11, 2006 21:51
Vote:
 
Steve - any idea why it doesnt redirect to the 404 handler? How should you handle an invalid id? Do you have to catch the PageNotFoundException in the Application_Error function for example? /John
#14359
Jan 17, 2006 17:51
Vote:
 
I haven't looked to much into it, but I can think of two things: 1. The SpiderSupport httpmodule has been removed from the httpModules section in web.config. 2. There might be some code in the spider module that short circuit the error handler (I believe robot friendly url's will give you trouble here.) Yes, to catch the PageNotFoundException, add your own handler to the Error event during application start-up (in global.asax), and check for that exception there. You could also check for other errors there, like System.IO.FileNotFoundException which will be thrown for missing files that are configured for asp.net. Also, handle the HttpException, but only for the 404 code, and you'll cover most of the 404's.
#14360
Jan 17, 2006 23:59
Vote:
 
I'm still having problems with this. my web config looks like this: In my Application_Start I have Global.EPDataFactory.LoadingPage += new PageEventHandler(ErrorHandler); in the ErrorHandler function I just have a try/catch which catches any exception and performs a redirect to another page just for testing. It works if I run from the server but not on remote machines despite having the option customErrors mode="On" Anybody got any ideas why? Is this a bug? Anyone browsing to a page with an invalid id from any machine than the server gets episervers standard error page but when i run locally on the server I get my error page. /John
#14361
Jan 18, 2006 14:53
Vote:
 
When I say it works I mean the stuff in the web config works but the error handler never gets used. /John
#14362
Jan 18, 2006 15:22
Vote:
 
My research shows that it makes no difference what is in the custom errors section in IIS as long as I have It also makes no difference if its On or RemoteOnly - except when its set to off and Im browsing on localhost I get "Server Error in '/' Application" - EPiServer.Core.PageNotFoundException: Page 529122 was not found. Just like when I browse from any other machine that is not localhost. I can point the 404 custom error page in IIS to anything - even a page that doesnt exist asp or aspx. It makes no difference if I am trying to surf a page with an invalid ID from another machine if im logged in or not logged in. I just get to see the stack trace when I am logged in and not when im not. I wonder therefore if this is a bug because my error handling code only gets run if im running on localhost (the desired result) and if Im browsing on any other machine I get "Server Error in '/' Application" - EPiServer.Core.PageNotFoundException: Page 529122 when i should get directed to my error page. Has anyone else had this problem? Is it a version problem? I am running 4.30 at the moment with an upgrade due before Åre :)
#14363
Jan 19, 2006 13:46
Vote:
 
dump from running from a remote machine: Page 529122 was not found at EPiServer.DataAccess.PageLoadDB.Load(PageReference pageLink) at EPiServer.DataFactory.?(PageReference ) at EPiServer.DataFactory.GetPage(PageReference pageLink, AccessLevel access) at EPiServer.PageBase.GetPage(PageReference pageLink) at EPiServer.SimplePage.get_CurrentPage() at EPiServer.EditPage.get_CurrentPage() at EPiServer.Core.LanguageManager.GetContextLanguage() at EPiServer.PageBase.get_EPLanguage() at EPiServer.PageBase.get_EPLocale() at EPiServer.PageBase.ActivateLocale() at EPiServer.PageBase.?() at EPiServer.PageBase.OnInit(EventArgs e) at EPiServer.TemplatePage.OnInit(EventArgs e) at development.Templates.Page.OnInit(EventArgs e) in C:\Inetpub\lvninternwebutv\root\templates\Page.aspx.cs:line 45 at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Page.ProcessRequestMain() Other notes: The error code that I use sits in the Application_Error()function in global.ascx I have 2 event handlers in Application_Start(): Global.EPDataFactory.FailedLoadingPage += new PageEventHandler(ErrorHandler); Global.EPDataFactory.LoadingPage += new PageEventHandler(ErrorHandler); None of those ever get triggered during my tests. /John
#14364
Jan 19, 2006 14:10
Vote:
 
It's a litte more complex than that. I don't have all of this in my head right now, but don't bother with the ASP.NET custom errors stuff. Turn off the EPiServer error handler, it will get in your way. Hook the Error event, not the FailedLoadingPage, this is where you can handle the exceptions. I'll show you a working version of this in Åre if you'd like to see it :-) /Steve
#14365
Jan 19, 2006 15:33
Vote:
 
Great Steve - see u on the train maybe - I'll be on from Gävle! I have hooked the Error event, as u said the EPiServer error handler is getting in my way it seems... How do you turn off the EPiServer error handler? /John
#14366
Jan 20, 2006 10:15
Vote:
 
Hi, I won't be on the train, leaving directly from Oslo. Turn off the error handler by setting EPsErrorHandling to Off. /Steve
#14367
Jan 21, 2006 12:41
Vote:
 
Thanks Steve - that fixed it! /John
#14368
Jan 23, 2006 9:52
Vote:
 

HI,

When i tried to access the forum page in relateplus i am getting the following error in pagebase class.



if (_generalErrorPage == null)
{
_generalErrorPage = DataFactory.Instance.GetPage((PageReference)_startPage["GeneralErrorPage"]);
}

    

Can anyone pls figure out this issue?

Thanks in advance.

MuraliKrishna.

#57086
Feb 24, 2012 5:48
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.