title: Limit number of users accessing a web ASP .NET application
body: <p>How do I limit the number of users to a web application.</p>
  
  <p>You may want to limit the web app to only handle say 20 users at a time. Our company sells applications based on a number of licenses, but we are not sure what the behaviour could be in a web app.</p>
  
  <p>I have seen some suggestions saying you can flag a user account as "LoggedIn = True" when a user has logged in. Then each new successful login attempt checks the number of "LoggedIn = True" records. If it exceeds the limit, then the user is rejected.</p>
  
  <p>How will unexpected input be handled in this case? What if:</p>
  
  <ul>
  <li>The user doesn't click logout, and closes the browser</li>
  <li>The browser crashes, and the user does not get a chance to do logout</li>
  <li>Network connection breaks, electricity on the client goes off etc etc.</li>
  </ul>
  
  <p>All the above will still have the "LoggedIn = True" flag set and contribute to the number of logged in users. This may unintentionally block out genuine authenticated users. </p>
  
  <p>I am looking more for ASP.NET solutions if possible.</p>