I have a problem creating a session in an application hosted using Owin. I tried using RedisSession , but I did not know how to configure it so that it would give me an error. I was looking for some solution, tried different things and finally decided to ask for help.
Scenario:
- I am registering the application using an HTTP POST request,
- The user login and password must be stored in the session,
- For each subsequent GET / POST request, which requires a previous login session, it is empty (login and password are zero).
The HTTPContext object HTTPContext empty.
I am using Ninject for dependency injection.
I tried something like this: Can OWIN middleware use an http session?
Does anyone know how to store login data in an Owin session?
The following is the Owin configuration file included with it. These are the links from the above.
[assembly: OwinStartup(typeof(Service.Startup))] namespace Service { public class Startup { public void Configuration(IAppBuilder appBuilder) { var config = new HttpConfiguration(); config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{action}/{id}", new { id = RouteParameter.Optional } ); appBuilder.RequireAspNetSession(); appBuilder.UseNinjectMiddleware(CreateKernel).UseNinjectWebApi(config); } public static StandardKernel CreateKernel() { var kernel = new StandardKernel(new Module()); return kernel; } } public static class AspNetSessionExtensions { public static IAppBuilder RequireAspNetSession(this IAppBuilder app) { app.Use((context, next) => {
source share