In database i have username,password,department,..
while login time i have to check username and department(in department i have fields are IT, employee, HR )
if username and department(IT) it should b redirect to It Page only
if username and department(Hr) it should b redirect to HR Page only
if username and department(Employee) it should b redirect to Employee Page only
and login.aspx i have only two filed user name and password..
following is my coding
public class LogIn
{
SqlDataAdapter adp;
DataSet ds;
public LogIn()
{
}
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrin gs["ConnectionString"].ConnectionString.ToString());
public DataSet select(string s)
{
adp = new SqlDataAdapter(s, cn);
ds = new DataSet();
adp.Fill(ds);
return ds;
}
}
in
login.aspx.cs
protected void btn_login_Click(object sender, EventArgs e)
{
DataSet DS = new DataSet();
string s = "select depertment from checkuser where user_name='" + txtusername.Text + "' and password='" + txtpassword.Text + "'";
DS = objlog.select(s);
if (DS.Tables[0].Rows.Count > 0)
{
Session["username"] = txtusername.Text;
Response.Redirect("Home.aspx");
}
}
m not getting how i wl do this..
reply asap.. m waiting
thank You