asp.net - Session Expires and User is no longer valid -


I cache information about the currently logged in user in session. Whenever the CurrentUser property is used on my global application class, this information is loaded, it calls GetUser () on my custom implementation of the subscription provider, which loads the user from the session. , Or loads the user with DB and throws the user object into the session.

How should I handle this scenario?

  1. User login.
  2. Deletes the user administrator (or disables ... the issue is that they can not enter any more)
  3. The user's session is ending < / Li>
  4. Users navigate or request a page, or whatever.

At present, if this scenario comes, NullReferenceExceptions are thrown everywhere, because ASP.NET Framework Call GetUser () does not give anything because it does not allow the user in the database Can not find (and nothing is in the session because it is finished).

If your app thinks that a user is signed in, but the user can not be found, then one The option FormsAuthentication.SignOut () may be used to forget about ASP.NET users, then they should be brought back to the long screen or the anonymous mode.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -