user338195
user338195

Reputation:

How to add users to ASP user database?

I have configured ASP user database. I can create users/roles either programmatically or by going to Project -> ASP.Net configuration in Visual Studio IDE.

Server this database is running on doesn't have VS installed. Is there a way to add users/roles through command line or IIS settings?

Thank you

Upvotes: 2

Views: 4956

Answers (3)

santiagoIT
santiagoIT

Reputation: 9431

If you set the connection string properly you can use VisualStudio running locally to configure your remote asp.net membership database. I do that all the time. Make sure your connections strings are right on your Web.Config file. This is the easiest unless you want to code it yourself.

*Edit *

Just to be clear, you are not required to have Visual Studio installed on the server which hosts the membership database.

However this only works if you are not storing any additional data per user which is not part of asp.net's MembershipUser class. In most cases you would implement a register page where you would collect the additional info. On submit you create a new MembershipUser (using MembershipProvider API) and then persist the additional information as best suits your needs. I typically use the MembershipProvider and have an store my custom info in an AppUsers table, (with the asp.net userId as a FK). Hope this helps ;-)

Using MembershipProvider and RoleProvider is very, very easy. Ask if you need some sample snippets.

Upvotes: 4

theChrisKent
theChrisKent

Reputation: 15099

You can create a simple site or an admin only page on your current site and use the CreateUserWizard control. A Guide to customizing this control can be found here: https://web.archive.org/web/20211020103243/https://www.4guysfromrolla.com/articles/070506-1.aspx

Documentation here: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.createuserwizard.aspx

You can also use the membership objects to do this through code if you want to create your own console application to do it from the command line.

Do not try and do this in the database directly.

Upvotes: 2

codewrath
codewrath

Reputation: 51

you can just add them manually to the database tables, there not that hard to deduce, just apply insert commands using your favorite sql client

Upvotes: 0

Related Questions