How to use session for verifying login in ASP .Net Core 2.0 by MVC (no authentication)

183 Views Asked by At

I had created a login form using MVC 5 No authentication template and connected with MS-SQL local Server, Now I need to verify the login status using session. I tried surfing about it but I can't able to find the optimal solution. So please some one help me to identify the optimal solution.

1

There are 1 best solutions below

0
On BEST ANSWER

Unless you are a security expert I would strongly advise that you don’t roll your own authentication.

Most of the documentation you will find on the web for authentication in an mvc app will be referencing asp identity. I would recommend using that unless you have a good reason not too.

Things like using

[Authorize]

On controller actions

And using

User.Identity.IsAuthenticated

To check if a user is logged in is all baked in.

No need to re-invent the wheel