954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Members and admins

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#

amm038
Newbie Poster
7 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

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.

sufyan2011
Junior Poster
166 posts since Dec 2011
Reputation Points: 9
Solved Threads: 20
 

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

amm038
Newbie Poster
7 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

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?

hericles
Practically a Posting Shark
823 posts since Nov 2007
Reputation Points: 136
Solved Threads: 168
 

thx alot hericles my problem is solved :)

thx alot you and sufyan

amm038
Newbie Poster
7 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You