Click here to Skip to main content
14,492,599 members
Rate this:
Please Sign up or sign in to vote.
I have been reading different articles of Microsoft to find out the best way to authenticate users before login into my application. However, my purpose is not met by those articles so I landed up here.

My Requirement:
I have a database of users that maintain user details like -Email, UserName, Password, Active status and so on when he registers. On registering, email will be send to admin of the system and when admin makes that user active, then only user will be able to logon.

Also, if user tries to access pages that is not authorized to be seen without logins, he should be redirected to login page.

What is the best practices to fulfill me need???

What I have tried:

Security, Authentication, and Authorization with ASP.NET MVC | Microsoft Docs[^]

Tried this link but for now I do not need any of the confirmation techniques stated here.
Updated 13-Mar-19 2:58am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

What's wrong with one of the links you already posted?

Create a secure ASP.NET MVC 5 web app with log in, email confirmation and password reset (C#) | Microsoft Docs[^]

If it doesn't do what you want exactly then amend it so that it does.
Codes DeCodes 13-Mar-19 11:41am
This link only tells about authentication for the first time. What I am looking for is that piece of code for authenticating user every time he logs in using tables from database.
F-ES Sitecore 13-Mar-19 12:49pm
In the Login action on the AccountController simply lock the users account and re-send the auth email.
Codes DeCodes 13-Mar-19 12:54pm
Somewhere I found formsauthenticaion class and now I am using that..
Anyways, thanks...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100