登录和注销功能,无需使用表单身份验证 [英] LogIn and LogOut functionality without using form authentication

查看:103
本文介绍了登录和注销功能,无需使用表单身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用登录名和登录名来实现登录和注销功能,该登录名取自数据库

I want to implement LogIn and LogOut functionality with login name taken from database

推荐答案

那是什么问题?
设计一个使用用户名/密码的登录页面.如果二者正确,则将其传递给数据库进行验证.正确表示正确,错误表示不正确.
如果 true :然后从登录页面导航到主页.将用户详细信息存储在会话中,并在其他页面的PageLoad上将其用作身份验证标志.现在,当您注销时,只需清除此会话即可.因此,每当尝试浏览其他页面时,由于会话为空,它们将直接指向登录页面.

如果 false :则显示错误的用户名/密码!

附言:此处的任何地方都不涉及Form的身份验证!
So whats the problem?
Design a login page that takes the username/password. pass on those two to the database for verification if they are correct. Get a true for correct and false for incorrect.
If true: then navigate from login page to home page. Store the user details in a session and use that on PageLoad of other pages as authentication flag. Now when you logout, just clear this session. Thus, whenever other pages are tried to be navigated, they will direct towards login page as session is empty.

If false: then show wrong username/password!

P.S.: Form''s authentication is not involved anywhere here!


这篇关于登录和注销功能,无需使用表单身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆