protected void SetDestinationURL(object sender, EventArgs e)
        {
            if (loginMember())            
                Response.Redirect("~/Member/Home.aspx");
            else if (loginManager())
                    Response.Redirect("~/Manager/Home.aspx");            
            else
                Response.Write("<script language=javascript>alert('Unauthorized User Access')</script>");
        }

        protected Boolean loginMember()
        {
            TextBox txtID = lgLogin.FindControl("UserName") as TextBox;
            TextBox txtPass = lgLogin.FindControl("Password") as TextBox;

            SqlConnection conLogin = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            SqlCommand cmdLogin;
            cmdLogin = new SqlCommand("SELECT UserName, Password FROM Member WHERE (UserName=@ID AND Password=@Pass)", conLogin);
            cmdLogin.Parameters.AddWithValue("@ID", txtID.Text);
            cmdLogin.Parameters.AddWithValue("@Pass", txtPass.Text);
            conLogin.Open();
            SqlDataReader myReader = cmdLogin.ExecuteReader();
            if (myReader.Read())
                return true;
            else
                return false;           
        }

        protected Boolean loginManager()
        {
            TextBox txtID = lgLogin.FindControl("UserName") as TextBox;
            TextBox txtPass = lgLogin.FindControl("Password") as TextBox;

            SqlConnection conLogin = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            SqlCommand cmdLogin;
            cmdLogin = new SqlCommand("SELECT UserName, Password FROM Manager WHERE (UserName=@ID AND Password=@Pass)", conLogin);
            cmdLogin.Parameters.AddWithValue("@ID", txtID.Text);
            cmdLogin.Parameters.AddWithValue("@Pass", txtPass.Text);
            conLogin.Open();
            SqlDataReader myReader = cmdLogin.ExecuteReader();
            if (myReader.Read())
                return true;
            else
                return false;            
        }

The codes from the above is i ever tried, but when i click the login button is doesn't redirect the specific pages.
The Login is insert from ASP.Net

Your if..else block doesnt seem to have hte correct syntax. You are missing some braces. It should look like this...

protected void SetDestinationURL(object sender, EventArgs e)
{
    if (Condition_1)
    {
        // Statement_1;
    }
    else if (Condition_2)
    {
        // Statement_2;
    }
    else
    {
        // Statement_n;
    }
}

In any case, once the syntax is correct, you should be able to find the problem by using Visual Studio to debug, or just put in Reponse.Write methods in each of the sections to find out what the values are when you are evaluating the conditions.

Thanks for the reply.
As i know the braces is doesn't matter due to i only need to execute one statement, but not multiples statement.

Ok, so maybe a better place to start as is the login button. When you click it, how do you know that the SetDestinationURL() function is being executed?

If it is executing the function, you have an if..else if..else block. one of the three choices must execute. If both if and else if is equal to false, the last else will execute.

If nothing is executing, that would indicate to me that the function is not being called.

Is working fine if i customize myself of the entire login design.
But i am wondering how do we able to link the user and password with our database and also from the ASP.NET web admin tool?

link the user and password with our database

I dont know what you mean by "link". You can simply perform a SQL query on the user table and search for a record where userid=@userid and password=@password and if you get at least one record back, you can assume the username and password combination is valid. You then track that user as "logged in".

and also from the ASP.NET web admin tool?

If you want to use the web admin tool, you will need to setup your SQL server appropriately. You can use the aspnet_regsql.exe tool to setup SQL. There's a lot of documentation online on how to use the tool. You then can use the Web Admin tool to configure your web.config file.

which mean i drag and drop the login into my design.
but the data comparison are compare with my own database? but the roles may be compare with web admin tool.
is that possible ?

This language is most importent because it use in web development

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.