Views: 18002
Number of votes: 5
Average rating:

404 handler for EPiServer 7

The 404 handler is now available for EPiServer 7. Along with all the nifty features from the previous versions, a few new ones have been added:

  • Enterprise support: Full URLs are now supported, meaning that you may redirect to different pages, based on your domain name.
    Example: If you have an enterprise setup with two sites, site1.com and site2.com, an “old url” setting of
    http://site1.com/some/url” will only redirect for site1.com, not site2.com.
  • No more 302’s: The module has been modified to no longer give those unwanted 302 responses for non-friendly URLs. SEO-Geeks, I hope you’re happy!
  • Easier administration: Having hundreds of custom redirect suggestions that no longer are valid?  A new administration view in the gadget has been added for easier administration of deleting and importing redirects.

redirectsBlogClean

-A new EPiServer 7-ish look has been implemented as well.

 

AdministerCleanPointer 

-Easier administration.

 

Redirects and suggestions that are saved in the older version will remain intact while upgrading. The module works on both webforms and MVC templates. Get it as a NuGet package at the EPiServer Nuget Feed, or as an EPiServer module at https://www.coderesort.com/p/epicode/wiki/404Handler, where you’ll also find more documentation and screenshots.

Feb 06, 2013

vincent.yang@orchardmarketing.com.au
( By vincent.yang@orchardmarketing.com.au, 2/7/2013 2:13:31 AM)

Can you give more detail instruction how to bring this to my dashboard? I installed this module via episerver nuget feed, however I can't see this from my Gadget

vincent.yang@orchardmarketing.com.au
( By vincent.yang@orchardmarketing.com.au, 2/7/2013 2:15:22 AM)

I figured this out. I have to rebuilt the entire solution.

Per Magne Skuseth
( By Per Magne Skuseth, 2/12/2013 8:36:40 AM)

Rebuilding the solution should not be necessary, as there are no files to build. However, I have experienced a few times that a restart of the site is needed before the gadgets appear for the first time.

( 2/12/2013 10:56:58 PM)

Nice work!

Joel Abrahamsson
( By Joel Abrahamsson, 2/25/2013 11:59:17 AM)

Hi! Just wanted to say really nice work. Works like a charm!

mdaftari@verndale.com
( By mdaftari@verndale.com, 3/5/2013 10:19:32 PM)

worked like a charm, Can you share the sample XML to do import will be great, i tried guessing the format by refraction but its not working. This will be great help.

mdaftari@verndale.com
( By mdaftari@verndale.com, 3/5/2013 10:32:25 PM)

worked like a charm, Can you share the sample XML to do import will be great, i tried guessing the format by refraction but its not working. This will be great help.

Per Magne Skuseth
( By Per Magne Skuseth, 3/5/2013 10:39:21 PM)

You'll find a sample on this page, under "example configuration file": https://www.coderesort.com/p/epicode/wiki/404Handler/DocCms5#Custom404HandlerCMS4and5

mdaftari@verndale.com
( By mdaftari@verndale.com, 3/6/2013 11:02:02 PM)

Thanks.

( 3/15/2013 2:51:26 PM)

I found different behavior comparing the old one for the Epi6.
We had in web.config
our handler Custom404Handler : INotFoundHandler,, and also some settings in BVN handler gadget.
So if there was a 404 error and it was not found in the list of predefined setting in gadget, then our above handler was executed,
We installed the new version in Epi7. With the same settings, and our custom handler was never executed, but the settings from the gadget was used.
So we changed in web.config to .
In this case our handler is executed every time, but there is not used the gadget values.
All other settings are the same like on the sample page..
What can be?

Per Magne Skuseth
( By Per Magne Skuseth, 3/20/2013 1:01:47 PM)

Hi, Botond.
We'll follow this up on CodeResort. Thanks

tym.lawrence@netcat.com.au
( By tym.lawrence@netcat.com.au, 4/22/2013 7:46:25 AM)

We recently implemented the custom redirect 404 gadget for a CMS 7 site. This site has friendly urls, such as '/en/about-us/management-team/'

For some reason, the gadget is logging over 1100 custom redirect suggestions, which have a '/null' at the end - for example /en/about-us/management-team/null

An in each case, the referring page is itself (eg /en/About-Us/management-team/ )

I tried deleting all the suggestions, but they keep getting generated.

Has anyone seen this before or have any idea of how to solve this? Its quite urgent as the site is set to go live today and I'd really like the 404 suggestions to be meaningful.

tym.lawrence@netcat.com.au
( By tym.lawrence@netcat.com.au, 4/22/2013 7:55:18 AM)

I've now raised a defect for this issue - see ​https://www.coderesort.com/p/epicode/ticket/327.

Benjamin Vangansewinkel
( By Benjamin Vangansewinkel, 6/4/2013 2:17:20 PM)

Could you explain how to use it in MVC how do I replace the 404NotFound.aspx by a controller + view?

Thank you for this module.

( 10/8/2013 6:55:02 PM)

BUMP for the above comment.

Is there anyway out of the box you can create the page template using an MVC controller rather than a webform page?

Per Magne Skuseth
( By Per Magne Skuseth, 10/10/2013 4:19:35 PM)

For the current version, it is unfortunately not possible. Hopefully, I'll have the time to work on the next version real soon where I'll get rid of the aspx.

Isabel Zitoun
( By Isabel Zitoun, 12/2/2013 1:37:06 PM)

Hi Per,

I was wondering if you know anything about the lang-files for the 404-handler?

My site is on swedish as default, and it works very well when I enter a page that dosent exist. I get the 404 as planned. But when trying to reach the 404 from the English version of the site, it doesn't work. It still uses the Swedish lang-files?

Looks like it cant reach the first level? i.e www.mysite.se/firstlevel/etctect

Do you know anything about this?

Best regards
Isabel

( 1/14/2014 4:33:52 PM)

Was this ever updated for use with an MVC Controller?

Mads Storm Hansen
( By Mads Storm Hansen, 2/1/2014 8:51:51 PM)

Looks like Mark did a nice contribution for MVC controllers:

github.com/markeverard/BVN.404Handler.MvcContrib

Jonas Boman
( By Jonas Boman, 4/14/2014 10:34:56 AM)

I cant get redirects for urls with ".aspx" to work.

Using MVC with Razor. Request to a aspx-file just turns out blank with status 200.

kevin.miller@orchardmarketing.com.au
( By kevin.miller@orchardmarketing.com.au, 7/1/2014 6:06:26 AM)

Hi,

We love your work on the BVN handler but we've come across a unique situation that I don't think is handled by the BVN module.

We have an old site URL which will be switched off and pointed at our EPiServer instance. We will need to redirect URLs from this other domain to another domain, which is not our EPiServer site (the site is a third party site that our EPiServer application is the front to).

So for example we need to redirect:

From: http://olddomain.com/this-old-page
To: http://third-party-site.com/new-page

Where our site URL would be https://episerver-site.com.

It seems that when you configure it this was the handler assumes that any redirect you are doing would be to a URL of the current site.

Is there anyway we could change the code to do this? We're happy to contribute to the code base if needed.

I realise we could use the UrRewrite module to do this and this might be what we do if we can't help change the code of the BVN handler.

Thanks,

Kevin

Minesh Shah (Netcel)
( By Minesh Shah (Netcel), 10/13/2014 11:28:09 AM)

I have installed this via Nuget on an EPi 7.5 solution using MVC and am getting the following error when trying to use the gadget am i missing a reference in the redirects view ?

2014-10-13 10:10:02,571 [40] ERROR EPiServer.Global: 1.2.5 Unhandled exception in ASP.NET
System.Web.HttpCompileException (0x80004005): d:\DevRoot2013\xxx\xxx.com\Main\Src\xxx.com.2014\modules\BVNetwork.FileNotFound.RedirectGadget\Views\Redirect\Index.ascx(4): error CS1061: 'object' does not contain a definition for 'IsSuggestions' and no extension method 'IsSuggestions' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean throwIfNotFound)
at System.Web.Compilation.BuildManager.GetCompiledType(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetCompiledType(String virtualPath)
at System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetCompiledType(String virtualPath)
at System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.b__17()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.b__19()
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
at System.Web.Mvc.Controller.ExecuteCore()
at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext)
at System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext)
at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.ProcessController(IController controller)
at EPiServer.Shell.Web.Mvc.ModuleMvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Per Magne Skuseth
( By Per Magne Skuseth, 10/15/2014 12:34:05 PM)

Check your modulesbin folder. There should be both BVNetwork.FileNotFound.RedirectGadget.dll and BVNetwork.EPi404.dll

David Sandeberg
( By David Sandeberg, 12/8/2014 1:27:36 PM)

I got the same error pointing to IsSuggestions. I think it has to do with the version of mvc that that is configured in /Modules/BVNetwork.FileNotFound.RedirectGadget/Views/Web.config. I removed the following:





Per Magne Skuseth
( By Per Magne Skuseth, 12/8/2014 1:31:07 PM)

Web.config, in the handler's view folder, should be removed

Thomas Hofmann
( By Thomas Hofmann, 2/6/2015 4:06:44 PM)

Hi, I'm migrating content to Epi and using this module to redirect traffic to published events

Event http://www.teknakurs.no/portal/page/portal/kurs/vis_arrangement?p_kp_id=44127 is found on several urls http://www.tekna.no/portal/page/portal/tekna/arrangementer/vis_arrangement?p_kp_id=44127&p_kurs_kalender=96473&frm_v01=&image.x=0&image.y=0

I want the rule to pick up the parameter p_kp_id=44127 from either url to redirect to a new EPi page, but it seems the _url is too long for it to find a match_. Shorter url's with the same parameter works fine. Any ideas how to solve this. Thanks!

Per Magne Skuseth
( By Per Magne Skuseth, 2/9/2015 8:43:50 AM)

Hi, Thomas.
I guess you could try to create implement an "INotFoundHandler". This will allow you to programatically handle every url that gives you an 404. Create a new class an implemented INotFoundHandler, then configure the 404 handler to use it. See an example of this configuration at https://www.coderesort.com/p/epicode/wiki/404Handler

( 2/17/2015 1:53:25 PM)

Just wanted to comment that we solved the above problem mentioned by Thomas. Since we had the IIS UrlRewrite module installed (for other use), the solution we found was to combine the two. Example:













This rule (in the Web.config) triggers *before* the URL is passed on to the BVN module.

Mats Stam
( By Mats Stam, 7/1/2015 3:20:53 PM)

Hey there, I have a question:

When you state no more 302:s. Does that mean the BVNetwork.FileNotFound.Handler.CustomFileNotFoundHandler's redirect? So when trying to use this with MVC I'm using BVN.404Handler.MvcContrib, which seems to do the correct 301 redirect, but all that happens after there's a 302 when using the 3.1.2 version of your project :)

What am I missing? =P

( 7/21/2015 4:01:22 AM)

Hi,

I added the https://www.coderesort.com/p/epicode/wiki/404Handler as well as https://github.com/markeverard/BVN.404Handler.MvcContrib to website on episerver 7 version.

What is working perfectly fine is : When i add redirect mapping from the gadget it works as expected.

I am struggling to redirect to a view placed in shared folder when 404 is encountered.

Basically i want to redirect to some friendly view instead of default implementation.

Existing settings in config:

 

 

/Not found is a notfound.cshtml inside /view/shared/notfound.cshtml.

Can some one suggest what changes do i need to make to make the custom redirect work.

Thanks in Advance.

Kevin Miller
( By Kevin Miller, 11/27/2015 4:01:38 AM)

Can I ask a question? Where does this module store the key/values? I ask as I've added two with the same key somehow. I want to delete one, so would like to know where to do this.

Please login to comment.