Last post Feb 07, 2017 10:02 AM by Eric Du
Jan 23, 2017 01:13 PM|damosull|LINK
I need to create admin login functionality for a website.
On the admin page, there are a number of different sections / pages which admin can update.
I need to have one admin account which has access to all sections, and I need a seperate account for each different section.
At the moment, on the Admin page I have all functionality displayed in seperate divs for each page. (Homepage, News, Sports, Groups, etc.)
Is it possible to hide/display different div's on the admin page, based on who is logged in at that moment?
Jan 23, 2017 01:41 PM|kaushalparik27|LINK
I need a seperate account for each different section
Implement logic of Rules/Groups in your code/database. Decide a Role/Group name for each different section and assign those Role to each account in database. This way, once a user is logged in then you need to write code to check what is the Role of currently
logged in user and based on that you can show/hide different sections
hope it helps./.
Jan 24, 2017 08:29 AM|Eric Du|LINK
According to your description, as far as i know, you are seeking thing is access permission is based on the login role, you could refer to this tutorial, when you login in the website, it will redirect to the different page(with different function) based
on the role of the user role!
Redirect a Login By Role in C# ASP .NET:
Jan 26, 2017 11:00 PM|damosull|LINK
Jan 27, 2017 07:39 AM|kaushalparik27|LINK
how do you stop non- admin users from simply accessing the admin page by entering the relevant URL?
When a user log in to your application, you can keep currently logged in user's Group/Role information in Session/Cookie. So, each time when user try accessing a page, you can check in Page_Load if current user has Role to access this page or not.
And if you are using ASP.NET Membership then you can use Location tags with assigned Roles to prevent such access.
Jan 27, 2017 10:39 PM|damosull|LINK
Feb 07, 2017 10:02 AM|Eric Du|LINK
you could try the following steps to achieve:
1. When you login in, you could select the role value from the database where the username equals to login name.
2. Store this role value to session, could judge the role value before redirect.
Like this snippet code:
if (role == "master")
else if (role == "Semi")
Response.Write("can not access");
1. when the user login out, you need delete role value in session.
2. when load master and Semi page, check if login or not. If not login, please login.