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..
m not getting how i wl do this..
reply asap.. m waiting
thank You

Krishna GaradRank #191 · 12.8K reputationPosted Dec 21, 2012, 2:55 AM EST
string sql="Select Department From TableName Where UserName='"+uname+"' and Password='"+password+"'";
Execute the above query and get the department from database after that check which department is reurned by above query.
if(department=="IT")
Response.Redirect("ITPage.aspx");
else if(department=="HR")
Response.Redirect("HRPage.aspx");
else if(department=="Emp")
Response.Redirect("EmpPage.aspx");
else
//invalid user
Jay Ahuja13 reputationPosted Dec 21, 2012, 7:24 PM EST
in class file i have
in
Sheikh parvazRank #9,090 · 211 reputationPosted Dec 21, 2012, 8:28 PM EST
if u really need to learn the authorisation of users then i will suggest you to go through the following link.
First you have to get the concept of the membership and roles of users. Then it will be very easy for you to manage the users and redirect them to their desired pages.
http://www.asp.net/web-forms/tutorials/security/membership/creating-the-membership-schema-in-sql-server-cs
http://www.asp.net/web-forms/tutorials/security/roles/creating-and-managing-roles-cs
Then the below code I am pasting which you will need later.
Jay Ahuja13 reputationPosted Dec 22, 2012, 12:31 AM EST
Krishna GaradRank #191 · 12.8K reputationPosted Dec 23, 2012, 7:47 PM EST
if(department=="IT")
Response.Redirect("ITPage.aspx");
else if(department=="HR")
Response.Redirect("HRPage.aspx");
else if(department=="Emp")
Response.Redirect("EmpPage.aspx");
else
//invalid user