1 override of Session
Microsoft.AspNetCore.Http (1)
DefaultHttpContext.cs (1)
198public override ISession Session
46 references to Session
Microsoft.AspNetCore.Http (1)
Features\DefaultSessionFeature.cs (1)
8/// <see cref="HttpContext.Session"/> property without the need for creating a <see cref="ISessionFeature"/>.
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
SessionStateTempDataProvider.cs (2)
33var session = context.Session; 52var session = context.Session;
Microsoft.AspNetCore.Session.Tests (39)
SessionTests.cs (39)
39Assert.Null(context.Session.GetString("NotFound")); 74Assert.Null(context.Session.GetString("Key")); 75context.Session.SetString("Key", "Value"); 76Assert.Equal("Value", context.Session.GetString("Key")); 129Assert.Null(context.Session.GetString("Key")); 130context.Session.SetString("Key", "Value"); 131Assert.Equal("Value", context.Session.GetString("Key")); 175int? value = context.Session.GetInt32("Key"); 182context.Session.SetInt32("Key", value.Value + 1); 224int? value = context.Session.GetInt32("Key"); 229context.Session.SetInt32("Key", 1); 235context.Session.Remove("Key"); 283int? value = context.Session.GetInt32("Key"); 288context.Session.SetInt32("Key", 1); 294context.Session.Clear(); 345context.Session.SetString("Key", "Value"); 392int? value = context.Session.GetInt32("Key"); 397context.Session.SetInt32("Key", 1); 460context.Session.SetInt32("Key", 10); 465var value = context.Session.GetInt32("Key"); 530context.Session.SetString("key", "value"); 613context.Session.SetString("KEY", "VALUE"); 614context.Session.SetString("key", "value"); 615Assert.Equal("VALUE", context.Session.GetString("KEY")); 616Assert.Equal("value", context.Session.GetString("key")); 654Assert.False(context.Session.TryGetValue("key", out var value)); 656Assert.Equal(string.Empty, context.Session.Id); 657Assert.False(context.Session.Keys.Any()); 704await Assert.ThrowsAsync<InvalidOperationException>(() => context.Session.LoadAsync()); 705Assert.False(context.Session.IsAvailable); 706Assert.Equal(string.Empty, context.Session.Id); 707Assert.False(context.Session.Keys.Any()); 756await Assert.ThrowsAsync<OperationCanceledException>(() => context.Session.LoadAsync()); 804await Assert.ThrowsAsync<OperationCanceledException>(() => context.Session.LoadAsync(token)); 855context.Session.SetInt32("key", 0); 918context.Session.SetInt32("key", 0); 981context.Session.SetInt32("key", 0); 985await Assert.ThrowsAsync<OperationCanceledException>(() => context.Session.CommitAsync(token)); 1045context.Session.SetInt32("key", 0);
SessionSample (4)
Startup.cs (4)
51visits = context.Session.GetInt32("visits") ?? 0; 52context.Session.SetInt32("visits", ++visits); 60visits = context.Session.GetInt32("visits") ?? 0; 70context.Session.SetInt32("visits", ++visits);