Skip to content

Session does not seem to be persisted across Http Requests #3228

@Etchelon

Description

@Etchelon

Hello.
I've enabled Session in my aspnet core 2.1 app. To do this I followed the documentation, and have added

services.AddDistributedMemoryCache();
services.AddSession(options =>
{
	options.IdleTimeout = TimeSpan.FromHours(1);
	options.Cookie.HttpOnly = true;
	options.Cookie.Name = ".Nuvyta.Session";
});

and

app.UseSession();

Problem: at every REQUEST, .HttpContext.Session.Id is different and the session storage is reset.
What is wrong? The documentation isn't that complex and doesn't say much more...

p.s.: my colleague just found out that the Session is persisted from the moment that something is actually set into it. Otherwise if it's empty it's reset every time... ok you should at least say this in the docs...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions