Echilon
Echilon

Reputation: 10244

ASP.NET: Total control of the ASP.NET membership provider

I have an application which uses the built in ASP.NET membership provider. There are two roles (admin and staff). I want admins to be able to see a list of current staff, add or delete staff and reset passwords. So far I've found very little information, but Membership.Provider.GetAllUsers looks promising. Is there any way I could show the list in a GridView?

At minimum, I need to be able to add and delete users through the site.

Upvotes: 1

Views: 754

Answers (3)

Echilon
Echilon

Reputation: 10244

I found an excellent tutorial at https://web.archive.org/web/20211020111539/https://aspnet.4guysfromrolla.com/articles/052307-1.aspx which made the whole thing slightly less murky. A nightmare to implement but it's almost working. Thanks for the replies.

Upvotes: 1

pyrocumulus
pyrocumulus

Reputation: 9290

For an extensive guide on using the Membership and Roleprovider in ASP.NET, see this tutorial: https://web.archive.org/web/20210513220018/http://aspnet.4guysfromrolla.com/articles/120705-1.aspx

Creating users programmatically is explained here: http://msdn.microsoft.com/en-us/library/d8t4h2es.aspx.

But really, MSDN is very complete on this subject. Just read the Introduction into Membership and follow the links. Everything you want is perfectly possible.

Upvotes: 6

pmarflee
pmarflee

Reputation: 3428

If you're using SQL Server, you can use the default SqlMembershipProvider class in System.Web.Security to perform the user management tasks you require. GetAllUsers() returns a string array, so you can databind your GridView to the result from this method to display a list of user names in your grid.

Upvotes: 0

Related Questions