DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Code Snippet: Working with ASP.Net 2.0 Membership Classes - Shalivn (http://www.daniweb.com/forums/thread217045.html)

Shalvin Mar 2nd, 2008 3:22 am
Working with ASP.Net 2.0 Membership Classes - Shalivn
 
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. 1.
  2. lstRoles.DataSource = Roles.GetAllRoles();
  3. DataBind();
  4.  
  5. 2.
  6. Roles.CreateRole("Admin");
  7.  
  8. 3.
  9. lstUsers.DataSource = Membership.GetAllUsers();
  10. DataBind();
  11.  
  12. 4. Membership.DeleteUser("Anish");
  13.  
  14. 5.
  15. Mebership.GetNumberOfUsersOnline();

All times are GMT -4. The time now is 12:49 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC