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.
-A new EPiServer 7-ish look has been implemented as well.
-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.
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
I figured this out. I have to rebuilt the entire solution.
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.
Nice work!
Hi! Just wanted to say really nice work. Works like a charm!
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.
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.
You'll find a sample on this page, under "example configuration file": https://www.coderesort.com/p/epicode/wiki/404Handler/DocCms5#Custom404HandlerCMS4and5
Thanks.
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?
Hi, Botond.
We'll follow this up on CodeResort. Thanks
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.
I've now raised a defect for this issue - see https://www.coderesort.com/p/epicode/ticket/327.
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.
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?
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.
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
Was this ever updated for use with an MVC Controller?
Looks like Mark did a nice contribution for MVC controllers:
github.com/markeverard/BVN.404Handler.MvcContrib
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.
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
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 ?
b__17()
b__19()
b__19()
b__19()
>> >> >> >
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.
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.
at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<>c__DisplayClass1c.
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)
Check your modulesbin folder. There should be both BVNetwork.FileNotFound.RedirectGadget.dll and BVNetwork.EPi404.dll
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:
Web.config, in the handler's view folder, should be removed
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!
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
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.
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
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.
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.
Hi
I can't find this screen . Where can I find that?