Hi Everyone,
I am new to ASP.NET, i am currently doing a project. I'd like to create a log in page using code. please assist. Some one give me a code sample of a log in page. Including connections to MSSQL database. I am totally lost.
A step by step guidance will be sincerely appreciated.Don't tell me to use the 'Administer Website' option, it isn't working.

Find the below code I think it is useful to you

protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    bool Authenticated = false;
    Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
    e.Authenticated = Authenticated;
    if (Authenticated == true)
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
    bool boolReturnValue = false;
    // Insert code that implements a site-specific custom 
    // authentication method here.
    // This example implementation always returns false.
    string strConnection  = "server=dtpxp-skumari;database=master;uid=sa;pwd=;";
    SqlConnection Connection = new SqlConnection(strConnection);
    String strSQL = "Select * From Employee";
    SqlCommand command =new SqlCommand(strSQL, Connection);
    SqlDataReader Dr;
    while (Dr.Read())
        if ((UserName == Dr["name"].ToString()) & (Password == Dr["Password"].ToString()))
            boolReturnValue = true;
    return boolReturnValue;


Edited 3 Years Ago by Nick Evan: Fixed formatting

please give me a step by step approach
i.e code for login.aspx, then a different code for login.aspx.cs, then the one for web.config
I'd trully appreciate

This article has been dead for over six months. Start a new discussion instead.