简体   繁体   中英

How to reload page after 3 login attempts with 401 unauthorised access error? in asp.net

When try to access site i created after 3 login attempts it gives unauthorised access error-401. how can i reload page after 3 attempts in asp.net. Any help is appreciated.

The best way is to store and manage these thing at backend(mean to say at SQL SERVER or any other server). If you are using the SQL SERVER then follow the following steps: 1). add a new column of int type in table named as invalidattempts 2). Now in logincheck Stored Proc, if the username and password are not authorized then update invalid column in table. and write the following code.

Declare @PasswordDB varchar(100)
Declare @InvalidDB int
if exists(select 1 from tblUser where email=@email)
begin
    set @PasswordDB= (Select password from tblUser where email=@email)
    if @PasswordDB=@Password
        begin
                print'login Successfully.'
        end
    else
        begin
            set @InvalidDB=(select invalidattempts from tblUser where email=@email)
update tblUser set invalidAttepmts=@InvalidDB+1 where email=@email 
select 3
end
end
else
begin
select 2
print'username does not exists.'
end

When you got 3 from sp then show an alert message that "You have made 3 invalid attempts thats is"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM