I am developing a website where in user is required to login to the system to be able to use it. The current functionality is: When user enters username and password, a check is
May be the old answers were worth observing at that time. However, I have currently resolved the problem using User.Identity.IsAuthenticated. I have EntityFramework 6 and using Dot Net Framework 4.7.2 and MVC 5. You need to set FormsAuthentication.SetAuthCookie(PrimaryKey, false); when user is loggedIn. Here, PrimaryKey is the key that you can use throughout the session for identification of the user using User.Identity.Name. Also, when user log out of the application, you will call FormsAuthentication.SignOut(); This actually saves the information in the browser cookie so that you can reuse the information.