If you want to create users to your web site, you should follow the next steps:

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition

1. Create a new page which contains the necessary text boxes for entering the required information.

2. Add a button

3. Handle the Click event of this button with the following code:

 

protected void ActionAddUser_Click(object sender, EventArgs e)

{

try

{

Membership.CreateUser(UserNameText.Text,

PasswordText.Text,

UserEmailText.Text);

StatusLabel.Text = “User created successfully!”;

}

catch(Exception ex)

{

Debug.WriteLine(“Exception: ” + ex.Message);

StatusLabel.Text = “Unable to create user!”;

}

}

 

The CreateUser method exists with several overloads. The easiest overload just accepts a user name and a password, while the more complex versions require a password question and answer as well.

Deleting users is as simple as creating users. The Membership class offers a DeleteUser() method that requires you to pass the user name as a parameter. It deletes the user as well as all related information, if you want, from the underlying membership store.