I just want to ensure they are logged in before running any code.
I found User.Identity.IsAuthenticated Which can be used for boolean to check login. But if I did redirect, it would still run code, plus I would have to put it everywhere?
In ROR there was a before_filter option we did, that checked at the top of each controller, and wouldnt run it otherwise.
Please can someone guide me on how to do this.
You can use
AuthorizeAttributefor this:For example: