How to add a Login, Roles and Profile system to an ASP.NET 2.0 app in only 24 lines of code
page 7 of 7
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 32017/ 50

Summary

Hopefully this walks-through a fairly common real-world web app scenario and explains how it can be easily done in ASP.NET 2.0.  The ASP.NET 2.0 Membership, Role and Profile system (especially when combined with the new login controls) pack a lot of productivity power. 

What is really nice is that they are all built on the new ASP.NET 2.0 provider model.  Our of the box ASP.NET ships built-in providers that provide Membership, Roles and Profile storage inside SQL Express, SQL Server and Active Directory stores (the later for Membership and Roles only).  What is even better is that you can replace any of these implementations using a custom provider that you either buy or build yourself (see this blog post for more details on how to-do this).  Replacing a provider in ASP.NET 2.0 simply involves changing a value in a web.config file – the above code sample will work regardless of what provider was plugged in (LDAP, Oracle, DB2, Custom SQL Table Schema, File-System, etc).

Hope this helps,

Scott


View Entire Article

User Comments

Title: Thanks for the TRICK   
Name: Ankit Singhal
Date: 2009-12-20 3:05:23 PM
Comment:
Thanks a lot for such a wonderful idea.. it worked for me when used CreatedUser and FinishButtonClick Events in place of the Events u suggested. Great Idea. God Bless you :-)
Title: problem!!!!!   
Name: avinash
Date: 2008-04-07 4:01:15 AM
Comment:
this code works fine with me in a public authorization folder! i need this code to make only role "admin" can create accounts so i placed it in a folder with admins only authorized! but the problem is that t creates the account but don't assign any role!! can any body help with this ?
Title: Roles   
Name: Hossam
Date: 2007-07-11 3:47:45 AM
Comment:
this code works fine with me in a public authorization folder! i need this code to make only role "admin" can create accounts so i placed it in a folder with admins only authorized! but the problem is that t creates the account but don't assign any role!! can any body help with this ?
Title: next step   
Name: dupls
Date: 2007-03-21 1:29:34 PM
Comment:
Is there any tutorial out there that will take this to the next level and place those details into another table in the database?

I've followed Scott through a zillion sites he is truly amazing. Very helpful code!
Title: Ruler of the Universe   
Name: Rick
Date: 2007-03-08 7:39:47 PM
Comment:
Not too many comments here, but I think this is a fantastic soution. Thank you for sharing with us, Scott.
Title: Mr   
Name: Pilling
Date: 2006-11-14 11:17:50 AM
Comment:
Anyone have the rolls bit in vb?

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-25 11:39:29 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search