title: Strategies for deleting a logged-in user in ASP.NET Core Identity
body: <p>In my ASP.NET Core MVC application, an administrator may wish to delete a regular user from their organisation. This of course is trivial using the built-in Identity model, using the <code>UserManager&lt;T&gt;.DeleteAsync()</code> method.</p>
  
  <p>However, the user may be logged in on multiple devices at the time. I don't need real-time messaging - I'm happy for the deleted user to be returned to the login page upon their next request. SignalR feels like an overkill for this situation.</p>
  
  <p><code>Request.User.Identity.IsAuthenticated</code> remains true during their session, even though their account has been deleted from the backing store.</p>
  
  <p>My thought process is to override <code>OnActionExecutingAsync()</code> on the base controller and check for a valid record in the backing store upon each request and then take appropriate action (e.g. signout + redirect to login), but this feels like a significant overhead to perform on each request, especially since the backing store is CosmosDb and this will cost extra Request Units.</p>
  
  <p>I also need to consider AJAX requests as significant pages within the MVC application have dynamic elements and the user might stay on a single page for a long time.</p>
  
  <p>What's the most effective, lightweight way to check if their user account has been deleted upon next request?</p>