Using ASP.NET 2.0 log in controls - Creating the first user

  • Thread starter Thread starter Matt Adamson
  • Start date Start date
M

Matt Adamson

Guys,

I'm thinking of using the various log in controls ASP.NET 2.0 provides e.g.
the CreateNewUserWizard. However my first question is how do I get a new
user into the system initially to actually log in and create new users?

Should I use SQL to directly insert a user record into the aspnet_Membership
and aspnet_User tables or use the API to create a new user with an admin
type role?

Best Regards

Matt
 
Hi!
I'm thinking of using the various log in controls ASP.NET 2.0 provides
e.g. the CreateNewUserWizard. However my first question is how do I get a
new user into the system initially to actually log in and create new
users?

You can create a new user through the CreateUserWizard control or
the "Administrative Application" from VS2005, "Website - ASP.NET
Configuration".
Should I use SQL to directly insert a user record into the aspnet_Membership
and aspnet_User tables or use the API to create a new user with an admin
type role?

Yes, you can call directly the store procedure of the ASPNETDB database:
SqlCommand command1 = new SqlCommand("dbo.aspnet_Membership_CreateUser",
holder1.Connection);
(use Reflector to get the complete code)

You can create a user by code using this code:
Membership.CreateUser(...);

To manage rules you should use the same tool, the "Administrative
Application" provided by
VS2005.
Best Regards
Matt

Matteo Migliore.
 
Back
Top