March 2018
Beginner to intermediate
410 pages
10h 40m
English
Now that we have the credentials, we need to check them against our user database. We will define a method for this, bool Login(UserName, Password), returning whether the credentials were authenticated or not. If successful, we set the session variable User, which we defined in the Markdown documents, to the corresponding user object. This tells the application that the user is logged in, and will stay logged in, while the session is maintained:
IUser User = this.Login(UserName, Password); if (User != null) { Log.Informational("User logged in.", UserName, req.RemoteEndPoint, "LoginSuccessful", EventLevel.Minor); req.Session["User"] = User; req.Session.Remove("LoginError"); throw new SeeOtherException(From); } else { Log.Warning("Invalid ...Read now
Unlock full access