开发者

How to stop user from going to login screen?

I have one application where in after user log-in (with username/password). After he enter the home page, he should not be al开发者_如何学Pythonlowed to go back to the log-in window.

hence either it could be;

  1. Not allowing to go back

OR

  1. Should log off the user if user is has been allowed to go back

Please help!

QUESTION EDITED


I would go with option 3: If a user hits the login page and they are already logged in, redirect them to the home page.


Check on login page before any actions if user is logined in and if it's so redirect him back(referrer) or to home page.


If you are using a simple Hyperlink, you can check on the PageLoad event of the Login page, whether the user is already logged in, and if yes, redirect to the home page.

Also if you are using the default authentication and authorization provider from ASP.NEt, simply use the login control, which will display "Login" for anonymous users and "Logout" for logged in users.


On page load check if a user is logged in, than change the login button to:

  • disabled, not visible

or

  • logoff button
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜