Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • paulthorpe 10 posts 193 karma points
    Jul 11, 2017 @ 16:13
    paulthorpe
    0

    Preview Page 404 When overridding ApplicationEventHandler

    I am running Umbraco 7.6.4 and I have been trying to use the preview system to check content changes on different pages, on every page when I click the preview button I am shown a 404 page The URL contains the following

    /umbraco/preview/?id=1066

    Looking on the machine the App_Data\Preview Folder is empty which I believe needs cache files for preview to work.

    After much testing I have established that I can get the preview to work if I comment out my RegisterEvents class that inherits from ApplicationEventHandler

    The code is as follows

    public class RegisterEvents : ApplicationEventHandler { protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication,ApplicationContext applicationContext) { base.ApplicationStarting(umbracoApplication, applicationContext); }

        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication,ApplicationContext applicationContext)
        {
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            AppConfiguration.RegisterGlobalFilters(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            DataAnnotationsModelValidatorProvider.AddImplicitRequiredAttributeForValueTypes = false;
    
            base.ApplicationStarted(umbracoApplication, applicationContext);
        }
    }
    

    If I remove this class everything works correctly I have also tried using the Global.asax method but with the same issues I believe the above is the correct way to register events though.

    Is this an issue with the Umbraco preview system or have I done some wrong in the above or missed out a setting any help would be a great help

  • paulthorpe 10 posts 193 karma points
    Jul 12, 2017 @ 07:20
    paulthorpe
    101

    If anyone has this kind of issues I manged to solve my issue. The RouteConfig I was running contained the following

    routes.RouteExistingFiles = true;

    I removed this and preview works.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies