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

EPiCode - Custom 404 Handler

Vote:
 

Hi

We are implementing a 404 handler in our project, see https://www.coderesort.com/p/epicode/wiki/404Handler

We have followed the instructions on the link above and everything works fine in IIS 5, but not in IIS 7.5 (32 bit). When using the following code in our aspx (see below) the webserver can't even find the file (ironically resulting in a 404 from the webserver). When removing the "Inherits..." the webserver can find the aspx. 

<%@ Page Language="c#" AutoEventWireup="true" Inherits="BVNetwork.FileNotFound.SimplePageNotFoundBase" MasterPageFile="~/Templates/Framework/Foo.Master" %>

I have also tried using NotFoundBase instead of SimplePageNotFoundBase but with the same problem.

Does anyone have experience configuring this handler for IIS7? If so, please assist.

#39523
May 19, 2010 13:35
Vote:
 

I did the following to get it to work on IIS 7.5:

  1. In IIS, open "Error Pages" and change the 404 to use 'Execute a URL on this site', Url should be /bvn/filenotfound/notfound.aspx
  2. Then, click "Edit Feature Settings" in right column (still under Error Pages section), and select "Custom error pages" with path same as the one above.
I'll make sure that the wiki-page on CodeResort is updated with screenshots.
#39535
May 19, 2010 16:17
Vote:
 

Hi

I tried doing what you described, but it did not work, I cannot even browse to the file http://localhost/FileNotFound.aspx

here's my config

</system.serviceModel>

 <system.webServer>

        <modules runAllManagedModulesForAllRequests="true">
        <modules runAllManagedModulesForAllRequests="true">

 

            <add name="InitializationModule" type="EPiServer.Web.InitializationModule, EPiServer" preCondition="managedHandler" />

            <add name="Initializer" type="EPiServer.Scheduler.Initializer, EPiServer.Scheduler" preCondition="managedHandler" />

            <add name="WorkflowRuntime" type="EPiServer.WorkflowFoundation.WorkflowSystem, EPiServer.WorkflowFoundation" preCondition="managedHandler" />

            <add name="UrlRewriteModule" type="EPiServer.Web.UrlRewriteModule, EPiServer" preCondition="managedHandler" />

 

            <add name="EventSubscriberHostModule" type="EPiServer.EventSubscriberHostModule, EPiServer" preCondition="managedHandler"/>

            <!--<add name="IIS5WebServicePostModule" type="EPiServer.Web.IIS5WebServicePostModule, EPiServer" preCondition="managedHandler" />-->

            <add name="EPiServerCommon" type="EPiServer.Common.Web.HttpModule, EPiServer.Common.Web" preCondition="managedHandler"/>

            <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="managedHandler"/>

            <add name="EPiServerCommunity" type="EPiServer.Community.Web.Administration.CommunityModule, EPiServer.Community.Web.Administration" preCondition="managedHandler"/>

            <add name="EPiServerCommunityCmsIntegration" type="EPiServer.Community.Web.CmsIntegration.HttpModule, EPiServer.Community.Web.CmsIntegration" preCondition="managedHandler"/>

            <add name="EPiServerMail" type="EPiServer.Mail.Core.Web.MailModule, EPiServer.Mail.Core.Web" preCondition="managedHandler"/>

            <!--<add name="RelatePlusCmsIntegrationModule" type="GlobalFeminineWeb.TeenHub.Templates.RelatePlus.HttpModules.CmsIntegrationModule, GlobalFeminineWeb" preCondition="managedHandler"/>-->

            <add name="BVNetwork.EPi404" type="BVNetwork.FileNotFound.Handler.CustomFileNotFoundHandler, BVNetwork.EPi404" />

        </modules>

      <handlers>

            <clear />

 

            <!--Försök att fixa login asmx-anropet-->

            <!--<remove verb="*" path="*.asmx"/>-->

            <add name="ScriptHandlerFactory" verb="*" path="*.asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode"/>

            <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode" />

 

            <add name="TraceHandler-Integrated" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="WebAdminHandler-Integrated" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="AssemblyResourceLoader-Integrated" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="PageHandlerFactory-Integrated" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="WebServiceHandlerFactory-Integrated" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="HttpRemotingHandlerFactory-rem-Integrated" path="*.rem" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="HttpRemotingHandlerFactory-soap-Integrated" path="*.soap" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />

            <add name="TRACEVerbHandler" path="*" verb="TRACE" type="" modules="ProtocolSupportModule" scriptProcessor="" resourceType="Unspecified" requireAccess="None" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />

            <add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" type="" modules="ProtocolSupportModule" scriptProcessor="" resourceType="Unspecified" requireAccess="None" allowPathInfo="false" preCondition="" responseBufferLimit="4194304" />

 

            <!--Ska dom här vara med-->

            <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

            <add name="VideoPostSignature" verb="GET" path="VideoPostSignature.ashx" type="EPiServer.Community.VideoGallery.VideoPostSignatureHandler, EPiServer.Community.VideoGallery"/>

            <add name="DynamicImage" verb="GET" path="cachedimageservice.axd" type="ComponentArt.Charting.CachedImageService,ComponentArt.Charting.WebChart"/>

            <!--Ska dom här vara med-->

 

            <add name="StaticFileHandler" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />

        </handlers>

         <staticContent>

            <mimeMap fileExtension=".woff" mimeType="application/octet-stream"/>

            <mimeMap fileExtension=".otf" mimeType="application/octet-stream"/>

            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00"></clientCache>

        </staticContent>

          <caching>

            <profiles>

                <add extension=".gif" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

                <add extension=".png" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

                <add extension=".js" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

                <add extension=".css" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

                <add extension=".jpg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

                <add extension=".jpeg" policy="DontCache" kernelCachePolicy="CacheUntilChange" duration="0.00:01:00" location="Any" />

            </profiles>

        </caching>

        <httpErrors errorMode="Custom">

          <remove statusCode="404"

                  subStatusCode="-1" />

          <error statusCode="404"

                 prefixLanguageFilePath=""

                 path="~/FileNotFound.aspx"

                 responseMode="ExecuteURL" />

        </httpErrors>

    </system.webServer>

 

#39547
May 20, 2010 8:59
Vote:
 

The download package and the documentation has now been updated, go to https://www.coderesort.com/p/epicode/wiki/404Handler 
Could you try to install the latest version?

#39639
May 26, 2010 15:56
* 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.