title: globally session check and redirection in asp.net mvc 4
body: <p>I am developing a web application using ASP.Net MVC 4, the application has one login page and 5 other pages which will be accessible by logged in users only.
  So how do i globally check the existence of session in all the pages without writing the following code in all the other pages(Actions)  : -</p>
  
  <pre><code>if (Session["login"] != null)
          {
              return View();
          }
          else
          {
              return RedirectToAction("LoginPage");
          }
  </code></pre>
  
  <p>Is there any other way to check session (authorization) globally and redirect to login page(Action)?
  Is this possible via Layout file? Like i'll create a common header layout to all the pages which will be accessed by logged in users so in that header layout is it possible to check for the session(authorization) and redirect to the login page (if not logged in) ?</p>