Session Expires and User is no longer valid?

If your app thinks a user is signed in but the user cannot be found, one option might be to use FormsAuthentication.SignOut() to make ASP. NET forget about the user. They should then be kicked back to the login screen or anonymous mode.

Throw an exception from GetUser() if you're going to return null. Then you can have the Application_Error event trap that specific exception and redirect to your login page.

I cache information about the currently logged in user in the session. This info lazy loads whenever a CurrentUser property on my global application class is used. It does this by calling GetUser() on my custom implementation of MembershipProvider, which either loads the user up from the session, or loads the user from the DB and throws the user object in the session.

How should I handle this scenario? User logs in. They can't log in any more).

User's session expires. User navigates to a page or makes a request, or whatever. Currently if this scenario occurs, NullReferenceExceptions are thrown all over the place, because the ASP .

NET framework calls GetUser() which returns nothing because it can't find the user in the database (and there's nothing in the session because it expired).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions