1 override of Session
Microsoft.AspNetCore.Http (1)
DefaultHttpContext.cs (1)
198
public 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)
33
var session = context.
Session
;
52
var session = context.
Session
;
Microsoft.AspNetCore.Session.Tests (39)
SessionTests.cs (39)
39
Assert.Null(context.
Session
.GetString("NotFound"));
74
Assert.Null(context.
Session
.GetString("Key"));
75
context.
Session
.SetString("Key", "Value");
76
Assert.Equal("Value", context.
Session
.GetString("Key"));
129
Assert.Null(context.
Session
.GetString("Key"));
130
context.
Session
.SetString("Key", "Value");
131
Assert.Equal("Value", context.
Session
.GetString("Key"));
175
int? value = context.
Session
.GetInt32("Key");
182
context.
Session
.SetInt32("Key", value.Value + 1);
224
int? value = context.
Session
.GetInt32("Key");
229
context.
Session
.SetInt32("Key", 1);
235
context.
Session
.Remove("Key");
283
int? value = context.
Session
.GetInt32("Key");
288
context.
Session
.SetInt32("Key", 1);
294
context.
Session
.Clear();
345
context.
Session
.SetString("Key", "Value");
392
int? value = context.
Session
.GetInt32("Key");
397
context.
Session
.SetInt32("Key", 1);
460
context.
Session
.SetInt32("Key", 10);
465
var value = context.
Session
.GetInt32("Key");
530
context.
Session
.SetString("key", "value");
613
context.
Session
.SetString("KEY", "VALUE");
614
context.
Session
.SetString("key", "value");
615
Assert.Equal("VALUE", context.
Session
.GetString("KEY"));
616
Assert.Equal("value", context.
Session
.GetString("key"));
654
Assert.False(context.
Session
.TryGetValue("key", out var value));
656
Assert.Equal(string.Empty, context.
Session
.Id);
657
Assert.False(context.
Session
.Keys.Any());
704
await Assert.ThrowsAsync<InvalidOperationException>(() => context.
Session
.LoadAsync());
705
Assert.False(context.
Session
.IsAvailable);
706
Assert.Equal(string.Empty, context.
Session
.Id);
707
Assert.False(context.
Session
.Keys.Any());
756
await Assert.ThrowsAsync<OperationCanceledException>(() => context.
Session
.LoadAsync());
804
await Assert.ThrowsAsync<OperationCanceledException>(() => context.
Session
.LoadAsync(token));
855
context.
Session
.SetInt32("key", 0);
918
context.
Session
.SetInt32("key", 0);
981
context.
Session
.SetInt32("key", 0);
985
await Assert.ThrowsAsync<OperationCanceledException>(() => context.
Session
.CommitAsync(token));
1045
context.
Session
.SetInt32("key", 0);
SessionSample (4)
Startup.cs (4)
51
visits = context.
Session
.GetInt32("visits") ?? 0;
52
context.
Session
.SetInt32("visits", ++visits);
60
visits = context.
Session
.GetInt32("visits") ?? 0;
70
context.
Session
.SetInt32("visits", ++visits);