ASP.NET MVC4 Redirect to login page

asp.net-mvc, asp.net-mvc-4, c#

Solution

Sure, decorate your actions or the whole class with `[Authorize]` and it will require that the user is logged in first.

Problem

I'm creating a web application using ASP.NET MVC 4 and C#. I want all users to be logged in before using application. I'm using ASP.NET Membership with a custom database. One method is check if `Membership.GetUser()` is null or not in every function. But isn't there any easier way than checking user login state in every function? (maybe checking in web.config, global.asax, etc...??)

Original source