如何为用户设置不同的角色。 [英] How to set diffrent role for the user.

查看:96
本文介绍了如何为用户设置不同的角色。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,

在我的项目中,我有一个页面,我可以添加用户,数据保存在数据库和数据字段中



Emp_id,Employee_code,First_name,Last_name,Gender,User_name,Password,ConformPass,mailid,Role,



现在,我想为每个人设置不同的角色用户(例如管理员,用户和员工),所以请告诉我如何为不同的用户设置角色,如果你有的话,请给我查询。



请帮助我..我是asp.net中的新手

Sir,
In my project, i have a page where i can add user & the data is save in a database & data fields are

Emp_id, Employee_code, First_name,Last_name, Gender, User_name, Password, ConformPass, mailid, Role,

Now, I want to set different role for every user(ex. admin, user and staff), so give me how to set the role for different users and please give me the query for that also, if you having it.

please help me ..i am new in asp.net

推荐答案

创建一个名为UserTypes的表包含以下字段:



user_type_id,user_type,creation_date,updation_date,is_enable





例如1,管理员,日期,日期,Y





并创建名为Roles的表,其中不同的用户是assigne角色:



role_id,role_name,creation_date,updation_date



例如LOCALRI00000001,管理员,日期,日期





更新角色或用户使用提交按钮上的更新查询。

实际上,你必须创建两个链接中的MasterPage应该是他们的

例如用户,角色,员工。
create a table called UserTypes with following fields:

user_type_id, user_type, creation_date, updation_date, is_enable


e.g 1, Admin, Date, Date, Y


and create also table called Roles in which different user to be assigne role:

role_id, role_name, creation_date, updation_date

e.g LOCALRI00000001, Admin, Date, Date


to update a role or user use updation query on submit button.
Actually, u have to create a MasterPage in that two link should be their
e.g. User, Roles, Employees.


作为初学者,我建议你选择 ASP-NET-Roles-and-Membership



使用asp.net'的角色功能,可以最小化所有数据库表和存储过程创建工作。 ASP.Net将为您创建和管理所有这些。

您将获得一个管理UI,您可以很好地管理登录,注册和用户页面访问角色。





希望有帮助



[快乐编码]
As a beginner I would suggest you to go with ASP-NET-Roles-and-Membership.

Using asp.net''s Role feature , you can minimize all the Database table and Stored procedure creation work . ASP.Net will create and manage all that for you .
You will be provided with a Admin UI , and you can well manage the login , registrations and the user page access roles .


Hope it helps

[ Happy Coding ]


这篇关于如何为用户设置不同的角色。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆