Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
protected void ctlLogin_Authenticate(object sender, AuthenticateEventArgs e)
    {
        bool Authenticated = false;

        Authenticated = UserAuthenticate(ctlLogin.UserName, ctlLogin.Password);
        e.Authenticated = Authenticated;
       if (Authenticated == true)
        {


            Response.Redirect("information1.aspx");

       }
    }

    private bool UserAuthenticate(string UserName, string Password) what this fuction do?
    {
       bool boolReturnValue = false;  what this line do?  
        //--------------------------------
        //Check UserID From Config File

            //--------------------------------
            dt = new DataTable();
            SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\omar\Documents\Visual Studio 2005\WebSites\Project1\App_Data\Database.mdf;Integrated Security=True;User Instance=True");
            string chkUser = "Select * FROM [User] where Email='" + UserName + "' AND Password='" + Password + "'";
            dt = dbClass.ConnectDataBaseReturnDT(chkUser);
            if (dt.Rows.Count > 0)
            {
                boolReturnValue = true; what this line do?
                Session["Id"] = dt.Rows[0]["Id"].ToString();
               string que = "UPDATE [User] SET LastLogin = GETDATE() where Id=" + Session["Id"].ToString();
              //  DateTime registerdate = (DateTime)dt.Rows[0]["RegisterDate"];
               // string que1 = "UPDATE [User] SET RegisterDate = GETDATE() where Id=" + Session["UserId"].ToString();
               dbClass.ConnectDataBaseToInsert(que);
                //dbClass.ConnectDataBaseToInsert(que1);
           }
           return boolReturnValue; what this line do?



    }



plz tell me about what is the sequence of execution of this code
private bool UserAutenicate(String UserName,String Password)

String UserName and Password Gets values form Where?
Posted
Comments
ambarishtv 25-May-11 11:11am    
same question
http://www.codeproject.com/Answers/201501/info-about-the-code.aspx#answer3

1 solution

I think you should read a book or two. Answers to your questions are quite evident. If your role is of a .Net developer in company, tell them you are not one. If you are a student, try following:

Put a break point at the following line in your code:

bool Authenticated = false;


Step through and into the code (use F11 to debug and not F10). This should help you understand how this works.

Hope this helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900