See the Designing part in Video:
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=RAN-PC;Initial Catalog=aspnew;Integrated Security=True"/>
</connectionStrings>
Watch The Database Connection Part in Video.
Code inside the Login Button:
Write the Script tag as:
Response.Write("<script>alert('successful in login')</script");
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=RAN-PC;Initial Catalog=aspnew;Integrated Security=True"/>
</connectionStrings>
Watch The Database Connection Part in Video.
Code inside the Login Button:
string constr = WebConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
SqlConnection con = new SqlConnection(constr);
try
{
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from aspnew where username='" + txtuser.Text + "' and password ='" + txtpass.Text + "' ", con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
cmd.ExecuteNonQuery();
if(dt.Rows[0][0].ToString()=="1")
{
Response.Write("alert('successful in login')"); //write Script tag before writing alert and close script tag as shown in below
Response.Redirect("~/Default2.aspx");
}
else
{
Response.Write("alert('error in login')"); //write Script tag before writing alert and close script tag
}
}catch(Exception ex)
{
Response.Write(ex.Message);
}
}
Write the Script tag as:
Response.Write("<script>alert('successful in login')</script");

