Click here to Skip to main content
15,910,471 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Good Day!, we are using ASP.net C# with SQL database. We don't know how to create a user type that direct to its designated page. Because our program has a 3 user types Admin Officer, Operation Officer and Staff Secretary.

What I have tried:

We only tried creating a log-in form that has only one user type, but it doesn't redirect to its designated page.
Posted
Updated 3-Jan-17 13:09pm
Comments
[no name] 3-Jan-17 15:22pm    
Do you expect us to guess at what is wrong with your code without seeing it?

1 solution

Hi,

Since you have not provided enough information, I am only assuming things here and providing what can be done.
I assume that;

1. In your database, you have a lookup table "UserTypes"
2. In your database, you have a users table with "UserTypeID" as a foreign key linked to the table in point No. 1 (UserTypes)
3. Upon successful login, user should be redirected to a specific page based on the type of the user

OK, here is what I would do;

1. I will add a column named "DefaultRedirectURL" to UserType table i.e. Each user type will have its own redirecURL
2. Have a single login page which validates the user name and password with the login database table
3. Upon successful login, I query the database for user information based on the login ID/name/code (whatever you use). This query will return me defaultRedirectURL along with all other information
4. I will grab that defaultRedirectURL and redirect the page accordingly.

I hope this resolves any issues.

Ask if you have any further questions.

Anyone else thinks this can be done in a better way, please suggest so that I can also improve my strategies - after all we are all coders.

Cheers
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900