Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am doing one job portal project in that i ahve 4 modules are there like guestuser,jobseeker,Employer and admin.

guestuser can access only default webpages but not authenticate webpage,if suppose guestuser wants to access the jobseeker's home page it will redirect to the login page.

I tried web.config but its not working?

Anyone give solution for this?
Posted

If you are using Membership[^] then it's simple: the server will handle all that for you.

If you aren't, then you should be!
 
Share this answer
 
Comments
Richard Deeming 29-Jul-15 7:45am    
For new projects, you should probably be using ASP.NET Identity[^], rather than the older Membership system. :)
Hi U store admin users in table,so when in admin page load event u get details form table and check that user is admin or not,if not then redirect to login page,for this in page load event u need to get user name in session variable,that session variable u have to add at the time of login,so username available in admin table allow other wise redirect to login page.

Check this link

[^ click]
 
Share this answer
 
v2
1) create a role table "Role" in the database & Insert all the roles u have mentioned here.
2) Map one role to each user in user table.
3) during the sign-in get the roleId along with the other details you need from user table and store in the session.
4) On Pageload check with the roleid stored in the session

ex: if(RoleID == "1")
{
//Do Some Operation
}
else
{
//Redirect user to some page with "No Access" Message
}


I hope this will be helpful for you.

Thanks
 
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