I save session state in azure redis cache using this .
NuGet RedisSessionStateProvider saves session state in Redis, and you can manage it since it was a clasiccal inProc Session.
When the user logs in, I do something like this:
AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity);
Session.Add("key", "value");
A session value is created all the time in the application. If you look at your REDIS cache, you will see these two keys snurztvlyl2jk5wnzstjikln_Internal snurztvlyl2jk5wnzstjikln_Data, where snurztvlyl2jk5wnzstjiklnis the SessionID.
When I write out:
public ActionResult LogOff()
{
Session.Abandon();
AuthenticationManager.SignOut();
return RedirectToAction("Index", "Home");
}
The user is SignOut, but if I look at the redis cache, the values are saved. They are not deleted and are deleted only after a session timeout. I also tried Session.Clear()and the keys in the Redis cache are still stored.
Why are the keys not deleted or what am I doing wrong?
. , .
https://github.com/ricardopolo/RedisIssue