使用c#在asp.net中进行基于角色和表单的身份验证 [英] Role and Forms Based Authentication in asp.net with c#

查看:87
本文介绍了使用c#在asp.net中进行基于角色和表单的身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi To Every One。



i已经开发了Web应用程序。



--- - >我有以下第5页页面如



1)pageone.aspx

2)pagetwo.aspx

3)pagethree.aspx

4)pagefour.aspx

5)pagefive.aspx





--->我有以下角色



1)管理员

2)HR

3)DTP

4)运营经理。





我的需求是ADMIN可以查看所有页面。 HR仅查看部分页面,部分页面仅对某些角色可见。







请帮助我 。这对我来说非常紧迫。用户名,密码,roll是动态来的。

解决方案

如果您使用的是 Asp.net 4.5或以上,那么您可以使用最新的 SimpleMembership。



简单会员,会员提供商,Universal Providers和新的ASP.NET 4.5 Web窗体和ASP.NET MVC 4模板



或者其它(旧版本)你可以使用 ASP.NET成员资格和角色提供程序。



ASP.NET会员和角色提供者


解决方案可以实施您的自定义站点地图提供程序通过扩展 StaticSiteMapProvider 类,并根据用户角色站点地图将包含某些页面的站点地图节点。



您可以找到我提供的其他QA问题的详细信息和代码 Asp.Net Web表单中的主页 [ ^ ]

Hi To Every One.

i had already developed the Web Application.

---->i have the Following Pages 5 pages like

1)pageone.aspx
2)pagetwo.aspx
3)pagethree.aspx
4)pagefour.aspx
5)pagefive.aspx


--->i have the following roles

1)ADMIN
2)HR
3)DTP
4)Operational Manager.


My Requierment is ADMIN can view all the Pages . HR Only view the Some Pages , Some pages are visible for only Some roles.



Please Help me . this is very urgent to me . the username, password , rolls are dynamically comes.

解决方案

If you're using Asp.net 4.5 or above then you can use latest SimpleMembership.

SimpleMembership, Membership Providers, Universal Providers and the new ASP.NET 4.5 Web Forms and ASP.NET MVC 4 templates

or else (older versions) you can use ASP.NET Membership and Role Provider.

ASP.NET Membership and Role Provider


A solution could be to implement your Custom Site Map Provider by extending StaticSiteMapProvider class, and based on the user roles the site map will contains the "site map nodes" for some pages or not.

You can find details and code provided by me for other QA Question Master Pages in Asp.Net Web forms[^]


这篇关于使用c#在asp.net中进行基于角色和表单的身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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