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#

Recommended Answers

All 4 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.