hi there

am bulding a system that have two types of users admin and users

in the login page i want when the users enter there username

if the username is in the admin table redirect to admin page

and if the username is in tha applicant table redirect to applicant page

how i do this ??

plz help

am using asp.net and C#

Edited by amm038: n/a

5 Years
Discussion Span
Last Post by amm038

Well it is a simple coding and doesn't invole any complex logic. If you saved the users in DB table, then each user should have role associated with him/her. When in Login page, user will enter his/her user name and password, verify it by querying from DB and if verified then get its role and on the basis of role, redirect to apporpirate page.


thx sufyan but can i have a little code offering solution for this problem ??


Do you know how to connect to a database and run an SQL query? Sufyan was simply saying that you can have 1 table for all users with a column that specifies their role. You then execute your SQL query:

SELECT * FROM users_table WHERE user_name = userID AND password = pwd;

Thats in its most basic form of course. You may not want to select all and your columns may vary but that query will return the number of rows matching that query and the result should be 1. If you use a dataReader to catch the result you can iterate to the role column, check the value and then do your redirect based on it.
Does that help?


thx alot hericles my problem is solved :)

thx alot you and sufyan

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.