Copied to clipboard

Flag this post as spam?

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


  • AbsolutelyN 85 posts 433 karma points
    Feb 06, 2023 @ 16:40
    AbsolutelyN
    0

    Prevent backoffice user logout if app restarts

    Hi

    If the application app pool restarts in IIS I'm getting logged out of umbraco. Same issue with sessions on the site I'm building. Using Umbraco 11 but same occurred in 10.

    In app settings I've got keep users logged in set to true

      "Umbraco": {
        "CMS": {
          "Security": {
            "KeepUserLoggedIn": true,
    ...
    }
    

    In startup I'm using SQL server session state - which should preserve sessions but these two get wiped out on an app restart.

    public void ConfigureServices(IServiceCollection services) {
    
    ...
    
                services.AddDistributedMemoryCache();
                services.AddDistributedSqlServerCache(options =>
                {
                    options.ConnectionString = _config.GetConnectionString(
                        "umbracoDbDSN");
                    options.SchemaName = "dbo";
                    options.TableName = "my-table";
                });
    
                services.AddSession();
    
    ...
    }
    
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
    
    app.UseSession();
    
    }
    

    If anyone can point out where I'm going wrong it would be much appreciated.

    Many thanks A

  • AbsolutelyN 85 posts 433 karma points
    Feb 07, 2023 @ 00:14
    AbsolutelyN
    0

    The answer is that you need to store the data protection keys. It was regenerating them on each app restart. Suspect this will also solve issues with the umbraco invites expiring unexpectedly.

    https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-6.0

  • Nijaz Hameed 30 posts 164 karma points
    Jan 19, 2024 @ 14:46
    Nijaz Hameed
    0

    Is umbraco backoffice sessions storing inside the table?

Please Sign in or register to post replies

Write your reply to:

Draft