简体   繁体   中英

User page access rights in asp.net?

有几个用户登录到我的项目,现在我想授予特定用户访问特定页面的权限,例如销售主管可以访问其销售团队成员的任何用户页面,但是销售团队成员不能访问访问销售主页。那么如何根据用户提供访问网页的权限?

Either you can choose to use the built in Membership features in asp.net or you can choose to implement your own custom Membership- and Role Provider.

The built in asp.net Membership Providers is a good option if your don't have to many users to manage.

However if you already have these users and their roles already managed somewhere else Active Directory, Sql Database etc then I would implement my own Membership- and Role Providers. You can read more about it in this example: http://msdn.microsoft.com/en-us/library/6tc47t75(v=vs.100).aspx

You need to add roles to your application. By adding roles and membership, users will have access to specific pages as you have assigned. They will need to login first to use your application!

There a number of ways to implement roles. One is on directory bases. You give specific privileges to a directory. The second is page by page basis. You use the function IsUserInRole on the page where you want to grant access.

You need to read some documentation on this. They are not too heard to implement, much of functionality is available ready made, for example logins controls are available that can be used without coding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM