ASP.NET - asp.net membership & role

Asked By esmaeil on 17-Jan-11 01:17 AM
hi.
sory. my english is not good

How can create roles for all users that each user only access to his own roles and have able to add or delete users from his roles (all users can create roles for themselves And each user access only to its own roles and can add or remove users to them)

thanks in advance
Reena Jain replied to esmaeil on 17-Jan-11 01:22 AM
hi,

ASP.NET membership gives you a built-in way to validate and store user credentials. ASP.NET membership therefore helps you manage user authentication in your Web sites. You can use ASP.NET membership with ASP.NET forms authentication by using with the ASP.NET login controls to create a complete system for authenticating users.

ASP.NET membership supports facilities for:

  • Creating new users and passwords.

  • Storing membership information (user names, passwords, and supporting data) in Microsoft SQL Server, Active Directory, or an alternative data store.

  • Authenticating users who visit your site. You can authenticate users programmatically, or you can use the ASP.NET login controls to create a complete authentication system that requires little or no code.

  • Managing passwords, which includes creating, changing, and resetting them . Depending on membership options you choose, the membership system can also provide an automated password-reset system that takes a user-supplied question and response.

  • Exposing a unique identification for authenticated users that you can use in your own applications and that also integrates with the ASP.NET personalization and role-management (authorization) systems.

  • Specifying a custom membership provider, which allows you to substitute your own code to manage membership and maintain membership data in a custom data store

here are some good links for you
http://weblogs.asp.net/scottgu/archive/2006/06/19/ASP.NET-2.0-Security_2C00_-Membership-and-Roles-Tutorials.aspx
http://www.4guysfromrolla.com/articles/120705-1.aspx
http://odetocode.com/articles/427.aspx

hope this will help you
Anoop S replied to esmaeil on 17-Jan-11 02:11 AM
The primary purpose of establishing roles is to give you an easy way to manage access rules for groups of users. You create users and then assign the users to roles (in Windows, to groups). A typical use is to then create a set of pages that you want to restrict to certain users. Often you isolate these restricted pages in a folder by themselves. Then you can establish rules that grant and deny access to restricted folders. For example, you can configure the site so that members or managers have access to the pages in the restricted folder and all other users are denied access. If an unauthorized user tries to view a restricted page, the user either sees an error or is redirected to a page that you specify.

To use ASP.NET role management, you enable it in an application's Web.config file by
<roleManager
    enabled="true"
    cacheRolesInCookie="true" >
</roleManager>


You can refer this for how to implement different role according to users
http://msdn.microsoft.com/en-us/library/5k850zwb.aspx