Hi @WindowsGeek ,
You have two ways to achieve this funtion.
First, you can set it in application via code. Assuming that you use asp.net application, you can use identity to manage users, passwords, profile data, roles, claims, tokens, email confirmation, and more. It will ask users to enter their password and username in any URL you want to set.
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser() { UserName = model.UserName };
var result = await UserManager.CreateAsync(user, model.Password);
if (result.Succeeded)
{
await SignInAsync(user, isPersistent: false);
return RedirectToAction("Index", "Home");
}
else
{
AddErrors(result);
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
You can combine it with authentication filter to ask for user credentials and authorization filter to manage user premission in any Action
. The advantage of using this method is that it stores user data in the database, and you can customize the number of users and the personal information that users need to fill in.
Second, you can achieve it in IIS manager. Deploy the application on IIS and find the login file. Then switch to feature view. Click authentication module and disable anonymous authentication, enable any other authentication. It is easy to set and don't need to write code. The disadvantage of it is that you cannot customiza any other user information when using windows authentication. It asks for account that exist in user group of windows server. You need to add or delete users manually on windows server.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Bruce Zhang