title: How to properly use Sessions in ASP.NET MVC Application?
body: <p>I am implementing a web application using ASP.NET MVC5. I am NOT using the conventional MVC authentication and authorization. I have opted to use <code>Sessions</code> instead as my application will be used by very few users and only locally. </p>
  
  <p>I have set a <code>Session["LoggedUser"]</code> inside <code>Application_Start()</code> in gloab.asax. The value of <code>Session["LoggedUser"]</code> is set upon login. I have then checked the value of the <code>Session["LoggedUser"]</code> using an <code>if</code> condition in multiple actions, such as <em>Edit</em> and <em>Delete</em>, etc.. If it equals blank string then the user is not authorized on that action/page and vice versa. Such pages will not be accessed directly.</p>
  
  <p>Now, in conventional MVC authorization and authentication, the use of <code>[AllowAnonymous]</code>, <code>[Authorize]</code> and <code>[Authorize(Roles="Admin")]</code> is very clean. These tags can be placed on any action in the controller and the authorization will be handled underneath. I was trying to find the equivalent of such tags to use in my session-based authentication and authorization. Perhaps, an efficient/better way to use Sessions in MVC application. Kindly guide me.</p>
  
  <p>Thanks in advance.</p>