如何使用角色来限制其他页面。 [英] how to use roles to restrict from other pages .

查看:44
本文介绍了如何使用角色来限制其他页面。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用为用户分配的角色以及如何使用roles限制用户。这些角色用于访问网页..

如何维护角色db table ..



hw使用用户角色访问/限制页面

i hv创建了一个具有uname pwd和角色的用户表..
管理员文件夹中


web.config

< system.web> 
< authorization>
< deny users = />
< allow roles = admin />
< deny roles = client />
< / 授权 >
< / system.web >




root web.config中的


 < authentication mode =  表单 >  
< forms name = 。ASPXFORMSDEMO loginUrl = client / samplelogin.aspx />
< / 身份验证 >







但是客户端uname和pwd我可以访问管理页面..





thq ..

解决方案

假设您正在使用会员资格(并且您应该be)这很简单:会员角色 [< a href =http://msdn.microsoft.com/en-us/library/yh26yfzy(v=vs.100).aspx\"target =_ blanktitle =New Window> ^ ]

how to use the roles assigned for the users and how to restrict the user using roles.how the roles are used in accessing the webpage..
how to maintain roles db table..

hw to use the user role to access/restrict from pages
i hv created one users table with uname pwd and role..
in admin folder
web.config

<system.web>
    <authorization>
      <deny users="?" />
      <allow roles="admin" />
      <deny roles="client" />
    </authorization>
  </system.web>



in root web.config

<authentication mode="Forms">
   <forms name=".ASPXFORMSDEMO" loginUrl="client/samplelogin.aspx" />
  </authentication>




but with client uname and pwd im getting access to admin pages..


thq..

解决方案

Assuming you are using Membership (and you should be) it''s pretty simple: Membership roles[^]


这篇关于如何使用角色来限制其他页面。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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