如何使用C#将用户角色添加到ASP.NET网页。 [英] How to add user roles to ASP.NET web page using C#.

查看:65
本文介绍了如何使用C#将用户角色添加到ASP.NET网页。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello All,



首先是我对这个编码和学习的新手。



我正在尝试为我的Web应用程序创建用户角色,其中每个用户将根据其姓名或ID生成单独的帐户和报告。



如何实现此目标?



例如:



将有两个用户

1.管理员

2.用户



因此,当管理员登录旅馆时,他/她可以相应地看到所有报告。

当用户登录旅馆时,他/她只能查看仅针对该特定用户的报告和数据。



请注意,我使用了ASP.NET默认Web模板以获得身份验证和会话的功能。那么,现在如何将用户角色添加到该默认模板。



另请注意,我需要一个注册表来创建新用户。



我尝试了什么:



我在谷歌搜索后偶然发现很多网站但无法得到逻辑或了解过程。



任何链接或代码对我都非常有帮助。



谢谢

Saikrishna

Hello All,

Firstly am new to this coding and learning step by step.

Am trying to create an User Roles for my Web Application where each User will have separate accounts and Reports generated according to their Names or ID.

How to achieve this?

Example:

There will be two Users
1. Admin
2. User

So when ever an Admin logs inn he/she can see all the reports accordingly.
And when an User Logs inn he/she can only view the reports and data which are meant to that particular User only.

Please, note that i have used ASP.NET default Web template in order to get the functionality of Authentication and Session. Well, now how to add user roles to that default template.

Also note that i need a registration form to create New User.

What I have tried:

I stumbled upon many sites after googling but unable to get the logic or understand the process.

Any Links or Code will be very helpful for me to understand.

Thanks
Saikrishna

推荐答案

阅读原始ASP.NET和MSDN文档有什么问题?



基于角色的安全性 [ ^ ],

了解角色管理 [ ^ ],

ASP.NET授权 [ ^ ],

没有代码行的基于粒度角色的安全性:基于属性的授权 [ ^ ];



基于角色的授权&安培; MDASH; ASP.NET文档 [ ^ ],

基于角色的授权(C#)| ASP.NET站点 [ ^ ]。



-SA
What's wrong about reading original ASP.NET and MSDN documentation?

Role-Based Security[^],
Understanding Role Management[^],
ASP.NET Authorization[^],
Granular Role Based Security Without a Line of Code: Attribute-Based Authorization[^];

Role based Authorization — ASP.NET documentation[^],
Role-Based Authorization (C#) | The ASP.NET Site[^].

—SA


这篇关于如何使用C#将用户角色添加到ASP.NET网页。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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