Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 9th, 2007, 02:43 AM
Authorized User
 
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Login Problem

hi friends,
can u help me to solve this problem....
 i want to allow my user only for 3 times to enter incorrect username or password.if continues with the same,the page should be closed.
how can i do this....I am working with c#.net and sqlserver....
                     thanking u..
__________________
sumith
 
Old March 9th, 2007, 08:00 AM
Friend of Wrox
 
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
Default

Well

Simplest method is to maintain a counter variable field & a date field in the database, in case of every incorrect login for the day (check with the date field), imcrement the counter variable, then restrict if count = 3, & if successful, set the counter to zero.

But don't forget to update the date field with current date, and manipulate accordingly to maintain counters.

Regards
Mike

Fortune favours the brave, so don't regret on missed oppurtunities.
 
Old March 9th, 2007, 08:10 AM
Authorized User
 
Join Date: Aug 2006
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi

one way is

take session variable
in which ur counter will be stored

in js check the value of session variable
if its greter than 3

window.close()


 
Old March 11th, 2007, 10:57 PM
Authorized User
 
Join Date: Aug 2006
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi friend,
 I am very new to the field of .net.i didnt get the concept of session variable.can u help me with a piece of code?? i have written the code as like this----

        private void Button3_Click(object sender, System.EventArgs e)
SqlConnection con1=new SqlConnection("server=localhost;Persist Security Info=False;User ID=sa;password=sa;Initial Catalog=sumith;Data Source=server0");


            try
            {


SqlCommand cmd1=new SqlCommand("select username,password from login",con1);
    con1.Open();
        SqlDataReader myreader = null;
        myreader=cmd1.ExecuteReader();

                while(myreader.Read())
                {
    {
        if(TextBox4.Text == myreader["username"].ToString() && TextBox3.Text == myreader["password"].ToString())
        {
        Label6.Text="Login Successful";
    }

                                                            }

if(TextBox4.Text != myreader["username"].ToString() || TextBox3.Text != myreader["password"].ToString())
                        {

                            Label6.Text="Login Failed";
                        }
                    }







                }
            }

            catch(SqlException ex)
            {

                Label6.Text=ex.Message;

                con1.Close();
            }



        }
    }





Similar Threads
Thread Thread Starter Forum Replies Last Post
Login Problem dpandit BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 3 March 17th, 2008 02:47 PM
Login Problem moonsrisun ASP.NET 2.0 Professional 1 May 24th, 2007 11:48 PM
Login Problem moonsrisun ASP.NET 2.0 Basics 0 May 24th, 2007 01:33 AM
Login problem slice2116 ASP.NET 2.0 Basics 5 July 6th, 2006 11:58 AM
Problem with Login -- HELP chiefg BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 3rd, 2004 04:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.