如何将我的登录设置为最多3次尝试 [英] How do set my login to maximum 3 attempts only

查看:86
本文介绍了如何将我的登录设置为最多3次尝试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我在3层进行申请,我的数据库中有一列减去尝试登录的次数。



需要一些示例



int counter = 0



if(username!= null && password!= null && counter == 0 )

{

成功登录

}



else if(username = = null &&密码== null)

{

counter = counter + 1

再试两次

}



我被困在下一个语句我需要将我的计数器存储在会话中

Hi I am doing my application in 3 tier and I have a column in my database to minus the number of tries to login.

Need some example

int counter = 0

if(username !=null && password !=null && counter == 0)
{
Successful login
}

else if (username ==null && password ==null )
{
counter = counter + 1
Two more tries
}

I am stuck for the next statement do I need to store my counter in a session

推荐答案

Quote:

我是否需要在会话中存储我的计数器

do I need to store my counter in a session

是。但 ViewState 在这里更有意义,因为此值仅用于此页面。所以,最好保存在 ViewState 并从那里读取。



如果你不保存在任何地方,每个它通过你的代码的时间,它再次将0分配给计数器

Yes. But ViewState makes more sense here as this value will only be used on this page. So, better save in ViewState and read from there.

If you don't save it anywhere, each time it goes through your code, it again assigns 0 to the counter


这篇关于如何将我的登录设置为最多3次尝试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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