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 GaradPosted Dec 24, 2012, 12:47 AM
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 AhujaPosted Dec 22, 2012, 5:31 AM
Sheikh parvazPosted Dec 22, 2012, 1:28 AM
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 AhujaPosted Dec 22, 2012, 12:24 AM
in class file i have
in
Krishna GaradPosted Dec 21, 2012, 7:55 AM
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