asp.net - programmatically logout a "specific" user -


Is it possible for a user to log in to aspen MVC? I know that you can use it:

  FormsService.SignOut ();  

But it requests the context of the webpage. I am trying to stop a user logging twice so if I call:

  membership user memberUSUSR = membership Getuser (username); If (membershipUser.IsOnline == true) {// logout this user, we can log them in FormsService.SignOut () again; }  

Calling FormsService.SignOut (); There is no effect on user context, already logged in with another webbrover?

This is a common method to accomplish this goal, on each page load, check that existing users Need to sign out or not.

  if (User.Identity.IsAuthenticated & amp; UserNeedsToSignOut ()) {FormsAuthentication.SignOut (); // Kill the authentication cookie: Response.Redirect ("~ / default.aspx"); // Make sure that you do not redirect to a cookie request)}  

You are concerned that this method will be very slow,

< P> "Why do I call this cursed function every page load? It hits the database every time!"

There is no need to slow it down. You can cache the list of users who should not be signed in at any time. If their username is in that cache, the sign-out code will be triggered the next time they access a page.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -