Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Threading;
using System.Threading.Tasks;
using System.Web.SessionState;
using Microsoft.AspNetCore.Http;
Expand Down Expand Up @@ -56,7 +57,11 @@ private async Task ManageStateAsync(HttpContextCore context, SessionAttribute me
try
{
await _next(context);
await state.CommitAsync(context.RequestAborted);

// If the request is being redirected, the client may disconnect before we have a chance to commit, so we don't want to
// use HttpContext.RequestAborted as it will be disconnected
var token = context.GetAdapter().Response.IsRequestBeingRedirected ? CancellationToken.None : context.RequestAborted;
await state.CommitAsync(token);
}
finally
{
Expand Down