0

I used this question accepted answer to highjack session start.

However - when I intercept new session start, I cannot access other global services which contains data I need on every session start and user request.

On old ASP.NET MVC 5 project, I did everythin at Global.asax on Application_AcquireRequestState event.

I need to access service, that I have added at ConfigureServices in Startup.cs

            services.AddSingleton<LocalisedResources>(
            sp => new LocalisedResources(Configuration.GetConnectionString("DefaultConnection")));

What am I missing?

SpoksST
  • 776
  • 1
  • 8
  • 24

1 Answers1

0

As it turns out - there was nothing to do with sessions.

Answer was found in this post and was simple.

Needed to add Required service when I added InistSession service.

            services
            .AddSingleton<IStartSession, InitSession>(serviceProvider =>
            new InitSession(serviceProvider.GetRequiredService<LocalisedResources>()));
SpoksST
  • 776
  • 1
  • 8
  • 24