Copied to clipboard

Flag this post as spam?

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


  • Nick Hoang 51 posts 180 karma points c-trib
    Nov 27, 2017 @ 01:45
    Nick Hoang
    0

    The cache file (Umbraco.config) doesn't update new data after call SaveAndPublishWithStatus

    Hello,

    I'm using latest version (7.7.6) and got this issue when using AutoNode plugin but it's not about AutoNode. I've the the source code of AutoNode and I think it's good, no error, no conflict...

    It's good when create new node via backoffice UI. So I decide to try to reproduce the issue my own without AutoNode and I think the issue comes from Umbraco. After SaveAndPublishWithStatus function called, no new data be updated in cache file. See my sample code here: https://drive.google.com/open?id=1Ku4J85pJFhgdnJHALshz5n4yv44wOInO

    admin: [email protected]/1234567890

    how to reproduce: create a People node under home, it will automatically create a child named "Dummy person" and it's published but not in the cache.

    Do anyone have experiences about this?

    Thanks, Nick

  • Luke Phelan 14 posts 85 karma points c-trib
    Nov 29, 2017 @ 03:51
    Luke Phelan
    0

    I don't have a solution for you Nick, but I am experiencing the same (or similar) issue.

    Upon Save, the Preview cache doesn't seem to update, so the Preview data is stale. It is refreshed correctly if you Save and Publish.

    I am not using AutoNode

  • Nick Hoang 51 posts 180 karma points c-trib
    Nov 29, 2017 @ 09:07
    Nick Hoang
    0

    Hi Luke Phelan,

    Thanks for your reply. And I've just update the link of attachment, the old one can't be public share. Sorry for my missing.

    Hearing for a good news.

    Cheers, Nick

  • Luke Phelan 14 posts 85 karma points c-trib
    Nov 29, 2017 @ 22:16
    Luke Phelan
    0

    Hi Nick,

    The issue is resolved on my end, it was due to our custom Owin Startup class, as we have an active directory login integration for this site.

    Basically we weren't calling app.UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.Authorize); in our Configuration function in our custom owin startup class.

    We were originally calling these

    app
       .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext, PipelineStage.Authenticate)
       .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext, PipelineStage.Authenticate)
    

    without the UseUmbracoPreviewAuthentication call, so even though we were logged in to the CMS, we were never authorised to view the preview so it would just load the current live site. This is why we could see changes on Save and Publish, but not on Save.

    Our entire class looks like this now

    public class UmbracoCustomOwinStartup : UmbracoDefaultOwinStartup
    {
        public void Configuration(IAppBuilder app)
        {
            //Configure the Identity user manager for use with Umbraco Back office
            // *** EXPERT: There are several overloads of this method that allow you to specify a custom UserStore or even a custom UserManager!            
            app.ConfigureUserManagerForUmbracoBackOffice(
                ApplicationContext.Current,
            //The Umbraco membership provider needs to be specified in order to maintain backwards compatibility with the 
            // user password formats. The membership provider is not used for authentication, if you require custom logic
            // to validate the username/password against an external data source you can create create a custom UserManager
            // and override CheckPasswordAsync
           MembershipProviderExtensions.GetUsersMembershipProvider().AsUmbracoMembershipProvider());
            // Due to a problem with the cookie management caused by OWIN and ASP.NET we need to use this KentorOwinCookieSaver as described here: https://stackoverflow.com/a/26978166/465509
            // If this isn't used, the external login will seemingly randomly stop working after a while.
            app.UseKentorOwinCookieSaver();
    
            //Ensure owin is configured for Umbraco back office authentication
            base.Configuration(app);
        }
    }
    

    Using the base Configuration at the end ensures we are calling all 3 of the required backoffice authorisation startup functions.

    Not sure if this will help you, but might help someone else who stumbles across the same issue.

Please Sign in or register to post replies

Write your reply to:

Draft