Working with ASP.Net 2.0 Membership Classes - Shalivn

Shalvin 0 Tallied Votes 101 Views Share

Web site Administration Tool is accessible only from the hosting server. Many times programmers won't have direct access to the the hosting server. So knowledge of ASP.Net Membership classes is an added advantage in creating an administrative module for the site.
In this code snippet we will take up:
1. Listing all roles
2. Creating a role
3. Listing all users
4. Deleting a user
5. Listing Number of users online

1. 
lstRoles.DataSource = Roles.GetAllRoles(); 
DataBind(); 

2. 
Roles.CreateRole("Admin"); 

3.
lstUsers.DataSource = Membership.GetAllUsers(); 
DataBind(); 

4. Membership.DeleteUser("Anish");

5.
Mebership.GetNumberOfUsersOnline();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.