I come from a PHP background and whenever I have created a login page and pages that require you to be logged in to see I have followed the approach found here:
How to check if a user is logged-in in php?
Which basically relies on creating a session and at the top of any page it checks if session exists and if not then it redirects back to the login page if session does not exist and if it does exist it continues to read the rest of the php code.
However, I am now trying to learn ASP.NET 3.1 and creating a web application using it. I have found a lot of resources on identity framework however that seems to have so much more than I really need when you compare what I was doing above in PHP which I assume is secure as is since no cookies are stored similar to what I see in most identity framework implementations.
I am not seeing any authentication examples similar to this PHP method in ASP.NET 3.1 where at the top of each razor page they check for session state and if it fails it redirects to the login page. I assume this should be a simple and secure method of doing this so why is it not as popular in ASP.NET Core? Also could you point me in the direction of a example of this being done if it is good practice similar to PHP. I will admit I found one example on Stackoverflow.com which I cannot seem to locate again where the user added a check for session function in the startup.cs file and indicated it would be bad practice but did not expand on it at all.